Documentation ¶
Overview ¶
Package openapi implements a library of Aliyun OpenAPI.
Index ¶
- Constants
- Variables
- func CanonicalizedHeader(header http.Header, prefix string) string
- func CanonicalizedQuery(q url.Values, escape bool) string
- func GetDomain(product, region string) string
- func HmacSha1(secret, data string) string
- func HmacSha256(secret, data string) string
- func HmacX(secret, data string, h func() hash.Hash) string
- func IsIn(s, v string) bool
- func Md5sum(data []byte) string
- func ReadBody(res *http.Response, v interface{}) error
- func SignatureROA(accessKeyId, accessKeySecret string, method string, path string, ...)
- func SignatureRPC(accessKeyId, accessKeySecret, method string, query url.Values)
- type Error
- type M
- type Params
- type Response
- type Service
Constants ¶
const ( RegionAPSoutheast1 = "ap-southeast-1" RegionCNBeijing = "cn-beijing" RegionCNHangzhou = "cn-hangzhou" RegionCNHangzhouD = "cn-hangzhou-d" RegionCNHongkong = "cn-hongkong" RegionCNQingdao = "cn-qingdao" RegionCNShanghai = "cn-shanghai" RegionCNShanghaiEt2B01 = "cn-shanghai-et2-b01" RegionCNShanghaiEt2Test01 = "cn-shanghai-et2-test01" RegionCNShenzhen = "cn-shenzhen" RegionUSWest1 = "us-west-1" )
Region List
Variables ¶
var Domains = map[string]map[string]string{ RegionCNHangzhou: { "Aas": "aas.aliyuncs.com", "Ace": "ace.cn-hangzhou.aliyuncs.com", "Alert": "alert.aliyuncs.com", "Bss": "bss.aliyuncs.com", "Cdn": "cdn.aliyuncs.com", "Cms": "metrics.aliyuncs.com", "Crm": "crm-cn-hangzhou.aliyuncs.com", "Dqs": "dqs.aliyuncs.com", "Drc": "drc.aliyuncs.com", "Drds": "drds.aliyuncs.com", "Dts": "dts.aliyuncs.com", "Ecs": "ecs-cn-hangzhou.aliyuncs.com", "Emr": "emr.aliyuncs.com", "Location": "location.aliyuncs.com", "M-kvstore": "m-kvstore.aliyuncs.com", "Ocs": "pop-ocs.aliyuncs.com", "Oms": "oms.aliyuncs.com", "Ons": "ons.aliyuncs.com", "Oss": "oss-cn-hangzhou.aliyuncs.com", "OssAdmin": "oss-admin.aliyuncs.com", "Ots": "ots-pop.aliyuncs.com", "PTS": "pts.aliyuncs.com", "Push": "cloudpush.aliyuncs.com", "R-kvstore": "r-kvstore-cn-hangzhou.aliyuncs.com", "ROS": "ros.aliyuncs.com", "Ram": "ram.aliyuncs.com", "Rds": "rds.aliyuncs.com", "Risk": "risk-cn-hangzhou.aliyuncs.com", "Slb": "slb-pop.aliyuncs.com", "Sts": "sts.aliyuncs.com", "Ubsms": "ubsms.aliyuncs.com", "Ubsms-inner": "ubsms-inner.aliyuncs.com", "Yundun": "yundun-cn-hangzhou.aliyuncs.com", }, RegionCNQingdao: { "Aas": "aas.aliyuncs.com", "Ace": "ace.cn-hangzhou.aliyuncs.com", "Alert": "alert.aliyuncs.com", "BatchCompute": "batchcompute.cn-qingdao.aliyuncs.com", "Bss": "bss.aliyuncs.com", "Cdn": "cdn.aliyuncs.com", "Cms": "metrics.aliyuncs.com", "Crm": "crm-cn-hangzhou.aliyuncs.com", "Dqs": "dqs.aliyuncs.com", "Drc": "drc.aliyuncs.com", "Drds": "drds.aliyuncs.com", "Dts": "dts.aliyuncs.com", "Ecs": "ecs-cn-hangzhou.aliyuncs.com", "Emr": "emr.aliyuncs.com", "Location": "location.aliyuncs.com", "M-kvstore": "m-kvstore.aliyuncs.com", "Ocs": "pop-ocs.aliyuncs.com", "Oms": "oms.aliyuncs.com", "Ons": "ons.aliyuncs.com", "Oss": "oss-cn-hangzhou.aliyuncs.com", "OssAdmin": "oss-admin.aliyuncs.com", "Ots": "ots-pop.aliyuncs.com", "PTS": "pts.aliyuncs.com", "Push": "cloudpush.aliyuncs.com", "R-kvstore": "r-kvstore-cn-hangzhou.aliyuncs.com", "ROS": "ros.aliyuncs.com", "Ram": "ram.aliyuncs.com", "Rds": "rds.aliyuncs.com", "Risk": "risk-cn-hangzhou.aliyuncs.com", "Slb": "slb-pop.aliyuncs.com", "Sts": "sts.aliyuncs.com", "Ubsms": "ubsms.aliyuncs.com", "Ubsms-inner": "ubsms-inner.aliyuncs.com", "Yundun": "yundun-cn-hangzhou.aliyuncs.com", }, RegionCNShenzhen: { "Aas": "aas.aliyuncs.com", "Ace": "ace.cn-hangzhou.aliyuncs.com", "Alert": "alert.aliyuncs.com", "BatchCompute": "batchcompute.cn-shenzhen.aliyuncs.com", "Bss": "bss.aliyuncs.com", "Cdn": "cdn.aliyuncs.com", "Cms": "metrics.aliyuncs.com", "Crm": "crm-cn-hangzhou.aliyuncs.com", "Dqs": "dqs.aliyuncs.com", "Drc": "drc.aliyuncs.com", "Drds": "drds.aliyuncs.com", "Dts": "dts.aliyuncs.com", "Ecs": "ecs-cn-hangzhou.aliyuncs.com", "Emr": "emr.aliyuncs.com", "Location": "location.aliyuncs.com", "M-kvstore": "m-kvstore.aliyuncs.com", "Ocs": "pop-ocs.aliyuncs.com", "Oms": "oms.aliyuncs.com", "Ons": "ons.aliyuncs.com", "Oss": "oss-cn-hangzhou.aliyuncs.com", "OssAdmin": "oss-admin.aliyuncs.com", "Ots": "ots-pop.aliyuncs.com", "PTS": "pts.aliyuncs.com", "Push": "cloudpush.aliyuncs.com", "R-kvstore": "r-kvstore-cn-hangzhou.aliyuncs.com", "ROS": "ros.aliyuncs.com", "Ram": "ram.aliyuncs.com", "Rds": "rds.aliyuncs.com", "Risk": "risk-cn-hangzhou.aliyuncs.com", "Slb": "slb-pop.aliyuncs.com", "Sts": "sts.aliyuncs.com", "Ubsms": "ubsms.aliyuncs.com", "Ubsms-inner": "ubsms-inner.aliyuncs.com", "Yundun": "yundun-cn-hangzhou.aliyuncs.com", }, }
Domains [Endpoint][Product]:Domain
var Regions = map[string]string{ RegionAPSoutheast1: RegionCNHangzhou, RegionCNBeijing: RegionCNHangzhou, RegionCNHangzhou: RegionCNHangzhou, RegionCNHangzhouD: RegionCNHangzhou, RegionCNHongkong: RegionCNHangzhou, RegionCNQingdao: RegionCNQingdao, RegionCNShanghai: RegionCNHangzhou, RegionCNShanghaiEt2B01: RegionCNHangzhou, RegionCNShanghaiEt2Test01: RegionCNHangzhou, RegionCNShenzhen: RegionCNShenzhen, RegionUSWest1: RegionCNHangzhou, }
Regions [Region]:Endpoint
var UserAgent = "aliyun-openapi-go-sdk"
UserAgent is the default user agent and is used by GetRequest.
Functions ¶
func CanonicalizedHeader ¶
CanonicalizedHeader canonicalized the prefix headers.
func CanonicalizedQuery ¶
CanonicalizedQuery canonicalized the query, if the escape is true the key and value are escaped.
func HmacSha256 ¶
HmacSha256 returns the base64 HMAC-SHA256 hash of the data using the given secret.
func HmacX ¶
HmacX returns the base64 HMAC-X hash of the data using the given secret.
The SHA1 is used if the given hash.Hash type is nil.
func ReadBody ¶
ReadBody reads the response body and stores the result in the value pointed to by v,
When the status code is 4xx or 5xx return the Error.
If v is nil, the response body is discarded or, if v's type is not *[]byte, *os.File and *bytes.Buffer, then decode XML or JSON to it.
Content-Encoding deflate and gzip are supported.
func SignatureROA ¶
func SignatureROA(accessKeyId, accessKeySecret string, method string, path string, query url.Values, header http.Header)
SignatureROA signature the ROA api style and set the Authorization header.
func SignatureRPC ¶
SignatureRPC signature the RPC api style and set the Signature query.
Types ¶
type Error ¶
Error represents the error response when the status code is 4xx or 5xx.
Relevant documentation:
https://docs.aliyun.com/#/pub/ecs/open-api/requestmethod&commonresponse
type Params ¶
type Params struct { Product string Style string Version string Method string Scheme string Region string Pattern string Path map[string]string Query, Body url.Values Header http.Header }
A Params represents the request parameters.
type Service ¶
type Service struct { Method string Unsafe bool Domain string AccessKeyId string AccessKeySecret string }
Service represents Aliyun Open API Service, the AccessKeyId and the AccessKeySecret are required.
func NewService ¶
NewService returns a new Service given a accessKeyId and accessKeySecret.
func (Service) Do ¶
Do sends an HTTP request and read the HTTP response to v.
See the method GetResponse and the function ReadBody to get more.
func (Service) GetRequest ¶
GetRequest returns a new Request given a Params.
func (Service) GetResponse ¶
GetResponse sends an HTTP request and returns the HTTP response.
See the method GetRequest to get more.