package common

import "github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/common"

Index

Constants

const (
	Hangzhou     = Region("cn-hangzhou")
	Qingdao      = Region("cn-qingdao")
	Beijing      = Region("cn-beijing")
	Hongkong     = Region("cn-hongkong")
	Shenzhen     = Region("cn-shenzhen")
	USWest1      = Region("us-west-1")
	APSouthEast1 = Region("ap-southeast-1")
	Shanghai     = Region("cn-shanghai")
)

Constants of region definition

const (
	SignatureVersion   = "1.0"
	SignatureMethod    = "HMAC-SHA1"
	JSONResponseFormat = "JSON"
	XMLResponseFormat  = "XML"
	ECSRequestMethod   = "GET"
)

Constants for Aliyun API requests

const (
	PayByBandwidth = InternetChargeType("PayByBandwidth")
	PayByTraffic   = InternetChargeType("PayByTraffic")
)
const Version = "0.1"

Variables

var ValidRegions = []Region{Hangzhou, Qingdao, Beijing, Shenzhen, Hongkong, Shanghai, USWest1, APSouthEast1}

Functions

func GetClientError

func GetClientError(err error) error

func GetClientErrorFromString

func GetClientErrorFromString(str string) error

Types

type Client

type Client struct {
	AccessKeyId     string //Access Key Id
	AccessKeySecret string //Access Key Secret
	// contains filtered or unexported fields
}

A Client represents a client of ECS services

func (*Client) GenerateClientToken

func (client *Client) GenerateClientToken() string

GenerateClientToken generates the Client Token with random string

func (*Client) Init

func (client *Client) Init(endpoint, version, accessKeyId, accessKeySecret string)

NewClient creates a new instance of ECS client

func (*Client) Invoke

func (client *Client) Invoke(action string, args interface{}, response interface{}) error

Invoke sends the raw HTTP request for ECS services

func (*Client) SetAccessKeyId

func (client *Client) SetAccessKeyId(id string)

SetAccessKeyId sets new AccessKeyId

func (*Client) SetAccessKeySecret

func (client *Client) SetAccessKeySecret(secret string)

SetAccessKeySecret sets new AccessKeySecret

func (*Client) SetDebug

func (client *Client) SetDebug(debug bool)

SetDebug sets debug mode to log the request/response message

func (*Client) SetEndpoint

func (client *Client) SetEndpoint(endpoint string)

SetEndpoint sets custom endpoint

func (*Client) SetVersion

func (client *Client) SetVersion(version string)

SetEndpoint sets custom version

type Error

type Error struct {
	ErrorResponse
	StatusCode int //Status Code of HTTP Response
}

An Error represents a custom error for Aliyun API failure response

func (*Error) Error

func (e *Error) Error() string

type ErrorResponse

type ErrorResponse struct {
	Response
	HostId  string
	Code    string
	Message string
}

type InternetChargeType

type InternetChargeType string

type Pagination

type Pagination struct {
	PageNumber int
	PageSize   int
}

func (*Pagination) SetPageSize

func (p *Pagination) SetPageSize(size int)

func (*Pagination) Validate

func (p *Pagination) Validate()

type PaginationResult

type PaginationResult struct {
	TotalCount int
	PageNumber int
	PageSize   int
}

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

type Region

type Region string

Region represents ECS region

type Request

type Request struct {
	Format               string
	Version              string
	AccessKeyId          string
	Signature            string
	SignatureMethod      string
	Timestamp            util.ISO6801Time
	SignatureVersion     string
	SignatureNonce       string
	ResourceOwnerAccount string
	Action               string
}

type Response

type Response struct {
	RequestId string
}

Source Files

client.go regions.go request.go types.go version.go

Version
v2.3.0+incompatible
Published
Feb 4, 2016
Platform
linux/amd64
Imports
9 packages
Last checked
14 hours ago

Tools for package owners.