Documentation
¶
Index ¶
- Constants
- Variables
- func GetClientError(err error) error
- func GetClientErrorFromString(str string) error
- type Client
- func (client *Client) GenerateClientToken() string
- func (client *Client) Init(endpoint, version, accessKeyId, accessKeySecret, region, service string)
- func (client *Client) Invoke(action string, args interface{}, response interface{}) error
- func (client *Client) SetAccessKeyId(id string)
- func (client *Client) SetAccessKeySecret(secret string)
- func (client *Client) SetDebug(debug bool)
- func (client *Client) SetEndpoint(endpoint string)
- func (client *Client) SetVersion(version string)
- type Credentials
- type Error
- type ErrorResponse
- type Pagination
- type PaginationResult
- type Region
- type Request
- type Response
Constants ¶
View Source
const ( SignatureVersion = "1.0" SignatureMethod = "AWS4-HMAC-SHA256" JSONResponseFormat = "JSON" XMLResponseFormat = "XML" RequestMethod = "GET" )
Constants for Ksyun API requests
View Source
const ( PayByBandwidth = "PayByBandwidth" PayByTraffic = "PayByTraffic" PrePaid = "PrePaid" PostPaid = "PostPaid" )
View Source
const Version = "0.1"
Variables ¶
View Source
var Regions = []Region{
{"cn-beijing-6", "北京6区"},
{"cn-shanghai-2", "上海2区"},
{"cn-hongkong-2", "香港2区"},
}
Regions 金山云支持的机房
Functions ¶
func GetClientError ¶
Types ¶
type Client ¶
type Client struct { AccessKeyId string //Access Key Id AccessKeySecret string //Access Key Secret Region string Service string // contains filtered or unexported fields }
A Client represents a client of kec services
func (*Client) GenerateClientToken ¶
GenerateClientToken generates the Client Token with random string
func (*Client) SetAccessKeyId ¶
SetAccessKeyId sets new AccessKeyId
func (*Client) SetAccessKeySecret ¶
SetAccessKeySecret sets new AccessKeySecret
func (*Client) SetEndpoint ¶
SetEndpoint sets custom endpoint
func (*Client) SetVersion ¶
SetEndpoint sets custom version
type Credentials ¶
type Credentials struct { AccessKeyID string SecretAccessKey string SecurityToken string `json:"Token"` Expiration time.Time }
Credentials stores the information necessary to authorize with AWS and it is from this information that requests are signed.
type Error ¶
type Error struct { ErrorResponse StatusCode int //Status Code of HTTP Response }
An Error represents a custom error for Ksyun API failure response
type ErrorResponse ¶
type Pagination ¶
func (*Pagination) SetPageSize ¶
func (p *Pagination) SetPageSize(size int)
func (*Pagination) Validate ¶
func (p *Pagination) Validate()
type PaginationResult ¶
A PaginationResponse represents a response with pagination information
func (*PaginationResult) NextPage ¶
func (r *PaginationResult) NextPage() *Pagination
NextPage gets the next page of the result set