common

package
v0.0.0-...-3d72318 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2014 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEBUG_VERBOSE = 0 // 0: off, 1~N:
)

Variables

View Source
var (
	TEST_CREDENTIALS_FILE string
)

Functions

func CloneHeader

func CloneHeader(h map[string]string, enc func(string, string) (string, string)) map[string]string

func Concat

func Concat(delim string, str ...string) string

func EncodeHeaderString

func EncodeHeaderString(h map[string]string) (string, string)

func EncodeQueryString

func EncodeQueryString(pars map[string]string) string

func EncodeURLString

func EncodeURLString(pars map[string]string) string

func EncodeUri

func EncodeUri(value string, encodeSlash bool) string

func GenUTF8Hex

func GenUTF8Hex(ch rune) string

func HashMD5

func HashMD5(content []byte) string

func HashSHA256

func HashSHA256(content []byte) string

func HmacSHA1

func HmacSHA1(key []byte, content string) []byte

func HmacSHA256

func HmacSHA256(key []byte, content string) []byte

Types

type AWSRequest

type AWSRequest struct {
	Method     string // "GET", "POST", "DELETE", etc.
	Path       string // absolute path, starts with '/'
	Headers    map[string]string
	Parameters map[string]string
	Payload    bytes.Buffer
}

func (*AWSRequest) DeleteParameter

func (this *AWSRequest) DeleteParameter(key string)

func (*AWSRequest) Init

func (this *AWSRequest) Init() *AWSRequest

func (*AWSRequest) Parameter

func (this *AWSRequest) Parameter(key string) string

func (*AWSRequest) SetParameter

func (this *AWSRequest) SetParameter(key string, value string)

type AWSResponse

type AWSResponse struct {
}

func (*AWSResponse) Init

func (this *AWSResponse) Init(req *AWSRequest, resp *http.Response) (*AWSResponse, error)

type AWSService

type AWSService struct {
	// ref: http://docs.aws.amazon.com/general/latest/gr/rande.html
	// TO-DO: convert endpoint to region & service.
	Region      string //  "us-west-1", etc.
	Service     string //  "ec2", "s3", etc.
	Endpoint    string // Note: S3 doesn't support hosted style, use path style always.
	Credentials *Credentials
}

func (*AWSService) Init

func (this *AWSService) Init(cred *Credentials) (*AWSService, error)

func (*AWSService) Sign4

func (this *AWSService) Sign4(req *AWSRequest, useAuthorizationHeader bool) (*http.Request, error)

type Credentials

type Credentials struct {
	AccessKeyID     string
	SecretAccessKey string
	SecurityToken   string
	Expiration      time.Time
}

func NewCredentialsFromCSV

func NewCredentialsFromCSV(filename string) (*Credentials, error)

*

credentials.csv file is download from amazon console
when you create an account.

func (*Credentials) Expired

func (cred *Credentials) Expired() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL