Documentation ¶
Overview ¶
client 包 核心代码包,请求相关代码, 如:client request response 其中也包括整个sdk的一下基本信息 @author cbping
Index ¶
- Constants
- type CDNRequest
- func (l *CDNRequest) Clone() interface{}
- func (Cdn *CDNRequest) DeadLine() time.Duration
- func (Cdn *CDNRequest) DelArgs(key string)
- func (Cdn *CDNRequest) HttpRequestInstance() (httpReq *http.Request, err error)
- func (Cdn *CDNRequest) ResponseFormat() string
- func (Cdn *CDNRequest) SetArgs(key, value string)
- func (Cdn *CDNRequest) Sign(cert *Credentials)
- func (Cdn *CDNRequest) String() string
- func (Cdn *CDNRequest) StructToArgs()
- type Client
- type Credentials
- type ErrorResponse
- type Request
- type Response
- type Unmarshal
Constants ¶
const ( DefaultSignatureVersion = "1.0" DefaultSignatureMethod = "HMAC-SHA1" JSONResponseFormat = "JSON" XMLResponseFormat = "XML" ECSRequestMethod = "GET" )
常量
const ( ApiCDNVersion = "2014-11-11" ApiCDNHost = "https://cdn.aliyuncs.com/" )
const Version = "0.1.2"
版本号
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CDNRequest ¶
type CDNRequest struct { Format string Version string AccessKeyId string Signature string SignatureMethod string Timestamp util.ISO6801Time SignatureVersion string SignatureNonce string // ResourceOwnerAccount string Action string // http Host string Method string Url string Args url.Values }
cdn 请求对象。实现 Request 接口
名称 类型 是否必须 描述 Format String 否 返回值的类型,支持JSON与XML。默认为XML \n Version String 是 API版本号,为日期形式:YYYY-MM-DD,本版本对应为2014-11-11 \n AccessKeyId String 是 阿里云颁发给用户的访问服务所用的密钥ID \n Signature String 是 签名结果串,关于签名的计算方法,请参见签名机制。\n SignatureMethod String 是 签名方式,目前支持HMAC-SHA1 \n Timestamp String 是 请求的时间戳。日期格式按照ISO8601标准表示,并需要使用UTC时间。格式为:YYYY-MM-DDThh:mm:ssZ。例如,2014-11-11T12:00:00Z(为北京时间2014年11月11日20点0分0秒)\n SignatureVersion String 是 签名算法版本,目前版本是1.0 \n SignatureNonce String 是 唯一随机数,用于防止网络重放攻击。用户在不同请求间要使用不同的随机数值 \n
func (*CDNRequest) DeadLine ¶
func (Cdn *CDNRequest) DeadLine() time.Duration
A Timeout of zero means no timeout.
func (*CDNRequest) DelArgs ¶
func (Cdn *CDNRequest) DelArgs(key string)
func (*CDNRequest) HttpRequestInstance ¶
func (Cdn *CDNRequest) HttpRequestInstance() (httpReq *http.Request, err error)
func (*CDNRequest) ResponseFormat ¶
func (Cdn *CDNRequest) ResponseFormat() string
func (*CDNRequest) SetArgs ¶
func (Cdn *CDNRequest) SetArgs(key, value string)
func (*CDNRequest) String ¶
func (Cdn *CDNRequest) String() string
type Client ¶
type Client struct { *Credentials ConnectTimeout time.Duration // contains filtered or unexported fields }
客户端 处理http请求
func NewClient ¶
func NewClient(cert *Credentials) (c *Client)
func NewClientTimeout ¶
func NewClientTimeout(cert *Credentials, connectTimeout time.Duration) (c *Client)
type Credentials ¶
type Credentials struct { //Access Key Id AccessKeyId string //Access Key Secret AccessKeySecret string }
Api请求凭证
func NewCredentials ¶
func NewCredentials(accessKeyId, accessKeySecret string) *Credentials
type ErrorResponse ¶
type ErrorResponse struct { RequestId string HostId string Code string Message string StatusCode int //Status Code of HTTP Response }
错误信息结构体
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string