diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 40d054196..000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ - - -build: off - -clone_folder: c:\gopath\src\github.com\aliyun\alibaba-cloud-sdk-go - -environment: - GOPATH: c:\gopath - matrix: - - go: 1.10.x - - go: 1.11.x - - go: 1.12.x - - go: 1.13.x - - go: 1.14.x - - go: 1.15.x - -platform: - - x64 - -install: - - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% - -test_script: - - go vet ./sdk - - go vet ./services/... - - go build ./sdk - - go build ./services/... - - go test -race -coverprofile=coverage.txt -covermode=atomic ./sdk/... - - IF DEFINED ACCESS_KEY_ID (go test -v -timeout 120s ./integration/...) - -after_test: - - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 4716cce6b..6e667d7d7 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -40,3 +40,5 @@ jobs: run: | go test -race -coverprofile=coverage.txt -covermode=atomic ./sdk/... test -z $ACCESS_KEY_ID -a -z $ACCESS_KEY_SECRET || go test -v -timeout 120s ./integration/... + - name: Upload coverage + run: bash <(curl -s https://codecov.io/bash) diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 77fabf4d3..000000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: go - -go: - - 1.10.x - - 1.12.x - - 1.14.x - - 1.15.x - - 1.16.x - -branches: # build only on these branches - only: - - master - -notifications: - webhooks: - urls: - - https://oapi.dingtalk.com/robot/send?access_token=096ed387df243a6d60835aadeccc47165f3813bc7cb81cdd0cfeadfd28e3acc1 - on_success: change - on_failure: always - -script: - - go vet ./sdk - - go vet ./services/... - - go build ./sdk - - go build ./services/... - - go test -race -coverprofile=coverage.txt -covermode=atomic ./sdk/... - - test -z $ACCESS_KEY_ID -a -z $ACCESS_KEY_SECRET || go test -v -timeout 120s ./integration/... - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/README-CN.md b/README-CN.md index 180659670..788ceccd4 100644 --- a/README-CN.md +++ b/README-CN.md @@ -6,132 +6,129 @@

Alibaba Cloud SDK for Go

-

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

+[![Go](https://github.com/aliyun/alibaba-cloud-sdk-go/actions/workflows/go.yml/badge.svg)](https://github.com/aliyun/alibaba-cloud-sdk-go/actions/workflows/go.yml) +[![codecov](https://codecov.io/gh/aliyun/alibaba-cloud-sdk-go/graph/badge.svg?token=kHbylWc7aV)](https://codecov.io/gh/aliyun/alibaba-cloud-sdk-go) +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Faliyun%2Falibaba-cloud-sdk-go.svg?type=shield&issueType=license)](https://app.fossa.io/projects/git%2Bgithub.com%2Faliyun%2Falibaba-cloud-sdk-go?ref=badge_shield&issueType=license) 欢迎使用 Alibaba Cloud SDK for Go。Alibaba Cloud SDK for Go 让您不用复杂编程即可访问云服务器、云监控等多个阿里云服务。 这里向您介绍如何获取 [Alibaba Cloud SDK for Go][SDK] 并开始调用。 ## 使用诊断 -[Troubleshoot](https://next.api.aliyun.com/troubleshoot?source=github_sdk) 提供 OpenAPI 使用诊断服务,通过 `RequestID` 或 `报错信息` ,帮助开发者快速定位,为开发者提供解决方案。 + +[Troubleshoot](https://api.aliyun.com/troubleshoot?source=github_sdk) 提供 OpenAPI 使用诊断服务,通过 `RequestID` 或 `报错信息` ,帮助开发者快速定位,为开发者提供解决方案。 ## 在线示例 -[阿里云 OpenAPI 开发者门户][open-api-portal] 提供在线调用阿里云产品,并动态生成 SDK 代码和快速检索接口等能力,能显著降低使用云 API 的难度。 +[阿里云 OpenAPI 开发者门户][open-api-portal] 提供在线调用阿里云产品,并动态生成 SDK 代码和快速检索接口等能力,能显著降低使用云 API 的难度。 ## 环境要求 + - 您的系统需要达到 [环境要求][Requirements], 例如,安装了不低于 1.10.x 版本的 Go 环境。 ## 安装 + 使用 `go get` 下载安装 SDK ```sh -$ go get -u github.com/aliyun/alibaba-cloud-sdk-go/sdk +go get -u github.com/aliyun/alibaba-cloud-sdk-go/sdk ``` -另外,Alibaba Cloud SDK for Go 也会发布在 https://develop.aliyun.com/tools/sdk#/go 这个地址。 - ## 快速使用 + 在您开始之前,您需要注册阿里云帐户并获取您的[凭证](https://usercenter.console.aliyun.com/#/manage/ak)。 ### 创建客户端 + ```go 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) - } + client, err := sdk.NewClientWithAccessKey("REGION_ID", "ACCESS_KEY_ID", "ACCESS_KEY_SECRET") + if err != nil { + // Handle exceptions + panic(err) + } } ``` ### ROA 请求 + ```go package main import "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" func main() { - request := requests.NewCommonRequest() // 构造一个公共请求 - request.Method = "GET" // 设置请求方式 - request.Product = "CS" // 指定产品 - request.Domain = "cs.aliyuncs.com" // 指定域名则不会寻址,如认证方式为 Bearer Token 的服务则需要指定 - request.Version = "2015-12-15" // 指定产品版本 - request.PathPattern = "/clusters/[ClusterId]" // 指定ROA风格路径规则 - request.ApiName = "DescribeCluster" // 指定接口名 - request.QueryParams["ClusterId"] = "123456" // 设置参数值 - request.QueryParams["RegionId"] = "region_id" // 指定请求的区域,不指定则使用客户端区域、默认区域 - request.TransToAcsRequest() // 把公共请求转化为acs请求 + request := requests.NewCommonRequest() // 构造一个公共请求 + request.Method = "GET" // 设置请求方式 + request.Product = "CS" // 指定产品 + request.Domain = "cs.aliyuncs.com" // 指定域名则不会寻址,如认证方式为 Bearer Token 的服务则需要指定 + request.Version = "2015-12-15" // 指定产品版本 + request.PathPattern = "/clusters/[ClusterId]" // 指定ROA风格路径规则 + request.ApiName = "DescribeCluster" // 指定接口名 + request.QueryParams["ClusterId"] = "123456" // 设置参数值 + request.QueryParams["RegionId"] = "region_id" // 指定请求的区域,不指定则使用客户端区域、默认区域 + request.TransToAcsRequest() // 把公共请求转化为acs请求 } ``` ### RPC 请求 + ```go package main import "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" func main() { - request := requests.NewCommonRequest() // 构造一个公共请求 - request.Method = "POST" // 设置请求方式 - request.Product = "Ecs" // 指定产品 - request.Domain = "ecs.aliyuncs.com" // 指定域名则不会寻址,如认证方式为 Bearer Token 的服务则需要指定 - request.Version = "2014-05-26" // 指定产品版本 - request.ApiName = "CreateInstance" // 指定接口名 - request.QueryParams["InstanceType"] = "ecs.g5.large" // 设置参数值 - request.QueryParams["RegionId"] = "region_id" // 指定请求的区域,不指定则使用客户端区域、默认区域 - request.TransToAcsRequest() // 把公共请求转化为acs请求 + request := requests.NewCommonRequest() // 构造一个公共请求 + request.Method = "POST" // 设置请求方式 + request.Product = "Ecs" // 指定产品 + request.Domain = "ecs.aliyuncs.com" // 指定域名则不会寻址,如认证方式为 Bearer Token 的服务则需要指定 + request.Version = "2014-05-26" // 指定产品版本 + request.ApiName = "CreateInstance" // 指定接口名 + request.QueryParams["InstanceType"] = "ecs.g5.large" // 设置参数值 + request.QueryParams["RegionId"] = "region_id" // 指定请求的区域,不指定则使用客户端区域、默认区域 + request.TransToAcsRequest() // 把公共请求转化为acs请求 } ``` - ## 文档 -* [Requirements](docs/0-Requirements-CN.md) -* [Installation](docs/1-Installation-CN.md) -* [Client & Credentials](docs/2-Client-CN.md) -* [SSL Verify](docs/3-Verify-CN.md) -* [Proxy](docs/4-Proxy-CN.md) -* [Timeout](docs/5-Timeout-CN.md) -* [Debug](docs/6-Debug-CN.md) -* [Logger](docs/7-Logger-CN.md) -* [Concurrent](docs/8-Concurrent-CN.md) -* [Asynchronous Call](docs/9-Asynchronous-CN.md) -* [Package Management](docs/10-Package-Management-CN.md) -* [Endpoint](docs/11-Endpoint-CN.md) +- [Requirements](docs/0-Requirements-CN.md) +- [Installation](docs/1-Installation-CN.md) +- [Client & Credentials](docs/2-Client-CN.md) +- [SSL Verify](docs/3-Verify-CN.md) +- [Proxy](docs/4-Proxy-CN.md) +- [Timeout](docs/5-Timeout-CN.md) +- [Debug](docs/6-Debug-CN.md) +- [Logger](docs/7-Logger-CN.md) +- [Concurrent](docs/8-Concurrent-CN.md) +- [Asynchronous Call](docs/9-Asynchronous-CN.md) +- [Package Management](docs/10-Package-Management-CN.md) +- [Endpoint](docs/11-Endpoint-CN.md) ## 问题 -[提交 Issue][issue] 不符合指南的问题可能会立即关闭。 +[提交 Issue][issue] 不符合指南的问题可能会立即关闭。 ## 贡献 + 提交 Pull Request 之前请阅读[贡献指南](CONTRIBUTING.md)。 ## 相关 -* [阿里云服务 Regions & Endpoints][endpoints] -* [阿里云 OpenAPI 开发者门户][open-api-portal] -* [Go][go] -* [最新发行版本][latest-release] +- [阿里云服务 Regions & Endpoints][endpoints] +- [阿里云 OpenAPI 开发者门户][open-api-portal] +- [Go][go] +- [最新发行版本][latest-release] ## 许可证 + [![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) [SDK]: https://github.com/aliyun/alibaba-cloud-sdk-go -[apache]: http://www.apache.org/licenses/LICENSE-2.0 [issue]: https://github.com/aliyun/alibaba-cloud-sdk-go/issues/new [open-api-portal]: https://next.api.aliyun.com/ [latest-release]: https://github.com/aliyun/alibaba-cloud-sdk-go/releases diff --git a/README.md b/README.md index 8d7ed0ecc..6da04dc36 100644 --- a/README.md +++ b/README.md @@ -1,142 +1,139 @@ English | [简体中文](README-CN.md) -

Alibaba Cloud SDK for Go

-

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

- +[![Go](https://github.com/aliyun/alibaba-cloud-sdk-go/actions/workflows/go.yml/badge.svg)](https://github.com/aliyun/alibaba-cloud-sdk-go/actions/workflows/go.yml) +[![codecov](https://codecov.io/gh/aliyun/alibaba-cloud-sdk-go/graph/badge.svg?token=kHbylWc7aV)](https://codecov.io/gh/aliyun/alibaba-cloud-sdk-go) +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Faliyun%2Falibaba-cloud-sdk-go.svg?type=shield&issueType=license)](https://app.fossa.io/projects/git%2Bgithub.com%2Faliyun%2Falibaba-cloud-sdk-go?ref=badge_shield&issueType=license) 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][SDK]. ## Troubleshoot + [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`. ## Online Demo -[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. +[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. ## Requirements + - 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. ## Installation + Use `go get` to install SDK: ```sh -$ go get -u github.com/aliyun/alibaba-cloud-sdk-go/sdk +go get -u github.com/aliyun/alibaba-cloud-sdk-go/sdk ``` ## Quick Examples + Before you begin, you need to sign up for an Alibaba Cloud account and retrieve your [Credentials](https://usercenter.console.aliyun.com/#/manage/ak). ### Create Client + ```go 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) - } + client, err := sdk.NewClientWithAccessKey("REGION_ID", "ACCESS_KEY_ID", "ACCESS_KEY_SECRET") + if err != nil { + // Handle exceptions + panic(err) + } } ``` ### ROA Request + ```go 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. + 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 aCertification 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 + ```go 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. + 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 -* [Requirements](docs/0-Requirements-EN.md) -* [Installation](docs/1-Installation-EN.md) -* [Client & Credentials](docs/2-Client-EN.md) -* [SSL Verify](docs/3-Verify-EN.md) -* [Proxy](docs/4-Proxy-EN.md) -* [Timeout](docs/5-Timeout-EN.md) -* [Debug](docs/6-Debug-EN.md) -* [Logger](docs/7-Logger-EN.md) -* [Concurrent](docs/8-Concurrent-EN.md) -* [Asynchronous Call](docs/9-Asynchronous-EN.md) -* [Package Management](docs/10-Package-Management-EN.md) -* [Endpoint](docs/11-Endpoint-EN.md) +- [Requirements](docs/0-Requirements-EN.md) +- [Installation](docs/1-Installation-EN.md) +- [Client & Credentials](docs/2-Client-EN.md) +- [SSL Verify](docs/3-Verify-EN.md) +- [Proxy](docs/4-Proxy-EN.md) +- [Timeout](docs/5-Timeout-EN.md) +- [Debug](docs/6-Debug-EN.md) +- [Logger](docs/7-Logger-EN.md) +- [Concurrent](docs/8-Concurrent-EN.md) +- [Asynchronous Call](docs/9-Asynchronous-EN.md) +- [Package Management](docs/10-Package-Management-EN.md) +- [Endpoint](docs/11-Endpoint-EN.md) ## Issues -[Opening an Issue][issue], Issues not conforming to the guidelines may be closed immediately. +[Opening an Issue][issue], Issues not conforming to the guidelines may be closed immediately. ## Contribution -Please make sure to read the [Contributing Guide](CONTRIBUTING.md) before making a pull request. +Please make sure to read the [Contributing Guide](CONTRIBUTING.md) before making a pull request. ## References -* [Alibaba Cloud Regions & Endpoints][endpoints] -* [Alibaba Cloud OpenAPI Developer Portal][open-api-portal] -* [Go][go] -* [Latest Release][latest-release] +- [Alibaba Cloud Regions & Endpoints][endpoints] +- [Alibaba Cloud OpenAPI Developer Portal][open-api-portal] +- [Go][go] +- [Latest Release][latest-release] ## License + [![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) [SDK]: https://github.com/aliyun/alibaba-cloud-sdk-go [issue]: https://github.com/aliyun/alibaba-cloud-sdk-go/issues/new -[open-api-portal]: https://next.api.aliyun.com/ +[open-api-portal]: https://api.aliyun.com/ [latest-release]: https://github.com/aliyun/alibaba-cloud-sdk-go/releases [go]: https://golang.org/dl/ [endpoints]: https://developer.aliyun.com/endpoints