core

package
v0.0.0-...-615e14e Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemeHttp  = "http"
	SchemeHttps = "https"

	MethodGet    = "GET"
	MethodPut    = "PUT"
	MethodPost   = "POST"
	MethodDelete = "DELETE"
	MethodPatch  = "PATCH"
	MethodHead   = "HEAD"

	HeaderJcloudPrefix         = "x-jcloud"
	HeaderJdcloudPrefix        = "x-jdcloud"
	HeaderJdcloudRequestId     = "x-jdcloud-request-id"
	HeaderJdcloudDate          = "x-jdcloud-date"
	HeaderJdcloudNonce         = "x-jdcloud-nonce"
	HeaderJdcloudAuthorization = "Authorization"
)
View Source
const (
	LogFatal = iota
	LogError
	LogWarn
	LogInfo
)
View Source
const (
	TimeFormat = "20060102T150405Z"
)
View Source
const Version = "1.0.0"

Variables

This section is empty.

Functions

func EscapePath

func EscapePath(path string, encodeSep bool) string

EscapePath escapes part of a URL path

Types

type Credential

type Credential struct {
	AccessKey string
	SecretKey string
}

Credential is used to sign the request, AccessKey and SecretKey could be found in JDCloud console

func NewCredential

func NewCredential(accessKey, secretKey string) *Credential

func NewCredentials

func NewCredentials(accessKey, secretKey string) *Credential

Deprecated

type DefaultLogger

type DefaultLogger struct {
	Level int
}

func NewDefaultLogger

func NewDefaultLogger(level int) *DefaultLogger

func (DefaultLogger) Log

func (logger DefaultLogger) Log(level int, message ...interface{})

type Logger

type Logger interface {
	Log(level int, message ...interface{})
}

type Signer

type Signer struct {
	Credentials Credential
	Logger      Logger
}

func NewSigner

func NewSigner(credsProvider Credential, logger Logger) *Signer

func (Signer) BackendSign

func (v4 Signer) BackendSign(host string, path string, method string, header http.Header, query url.Values, body string) (string, error)

secretKey, host, path, method, headers, queryString, body

func (Signer) Sign

func (v4 Signer) Sign(host string, path string, method string, header http.Header, query url.Values, body string) (string, error)

Sign signs the request by using AWS V4 signer algorithm, and adds Authorization header

Jump to

Keyboard shortcuts

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