service

package
v0.0.0-...-99de3cd Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2019 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CRC64Combine

func CRC64Combine(crc1 uint64, crc2 uint64, len2 uint64) uint64

CRC64Combine combines CRC64

func ComplexReader

func ComplexReader(reader io.Reader, refer map[string]string) io.ReadCloser

func NewCRC

func NewCRC(tab *crc64.Table, init uint64) *digest

NewCRC creates a new hash.Hash64 computing the CRC64 checksum using the polynomial represented by the Table.

func Prettify

func Prettify(i interface{}) string

func TeeReader

func TeeReader(reader io.Reader, writer io.Writer, totalBytes int64, listener utils.ProgressListener, tracker *utils.ReaderTracker) io.ReadCloser

TeeReader returns a Reader that writes to w what it reads from r. All reads from r performed through it are matched with corresponding writes to w. There is no internal buffering - the write must complete before the read completes. Any error encountered while writing is reported as a read error.

func XmlUnmarshal

func XmlUnmarshal(body []byte, result interface{}) (interface{}, error)

Types

type BaseClient

type BaseClient struct {
	RegionId         string   `json:"RegionId" xml:"RegionId"`
	Protocol         string   `json:"Protocol" xml:"Protocol"`
	Endpoint         string   `json:"Endpoint" xml:"Endpoint"`
	UserAgent        string   `json:"UserAgent" xml:"UserAgent"`
	HostModel        string   `json:"HostModel" xml:"HostModel"`
	SignatureVersion string   `json:"SignatureVersion" xml:"SignatureVersion"`
	IsEnableMD5      bool     `json:"IsEnableMD5" xml:"IsEnableMD5"`
	IsEnableCrc      bool     `json:"IsEnableCrc" xml:"IsEnableCrc"`
	ReadTimeout      int      `json:"ReadTimeout" xml:"ReadTimeout"`
	ConnectTimeout   int      `json:"ConnectTimeout" xml:"ConnectTimeout"`
	LocalAddr        string   `json:"LocalAddr" xml:"LocalAddr"`
	HttpProxy        string   `json:"HttpProxy" xml:"HttpProxy"`
	HttpsProxy       string   `json:"HttpsProxy" xml:"HttpsProxy"`
	NoProxy          string   `json:"NoProxy" xml:"NoProxy"`
	Socks5Proxy      string   `json:"SOCKS5Proxy" xml:"SOCKS5Proxy"`
	Socks5NetWork    string   `json:"SOCKS5NetWork" xml:"SOCKS5NetWork"`
	MaxIdleConns     int      `json:"MaxIdleConns" xml:"MaxIdleConns"`
	AddtionalHeaders []string `json:"AddtionalHeaders" xml:"AddtionalHeaders"`

	Logger *teautil.Logger
	// contains filtered or unexported fields
}

Client is for calling oss api

func (*BaseClient) Base64Decode

func (client *BaseClient) Base64Decode(value string) string

Decryption

func (*BaseClient) Default

func (client *BaseClient) Default(realStr string, defaultStr string) string

If realStr is not "", return realStr, or return defaultStr

func (*BaseClient) DefaultNumber

func (client *BaseClient) DefaultNumber(num int, defaultNum int) int

If num is not 0, return num, or return defaultNum

func (*BaseClient) Empty

func (client *BaseClient) Empty(val string) bool

func (*BaseClient) Encode

func (client *BaseClient) Encode(val string, encodeType string) string

Encryption

func (*BaseClient) Equal

func (client *BaseClient) Equal(val, val2 string) bool

func (*BaseClient) GetAccessKeyID

func (client *BaseClient) GetAccessKeyID() (string, error)

func (*BaseClient) GetAccessKeySecret

func (client *BaseClient) GetAccessKeySecret() (string, error)

func (*BaseClient) GetContentMD5

func (client *BaseClient) GetContentMD5(a string) string

Return md5 according to body

func (*BaseClient) GetContentType

func (client *BaseClient) GetContentType(name string) string

Return content-type according to object name

func (*BaseClient) GetDate

func (client *BaseClient) GetDate() string

Get Date in GMT

func (*BaseClient) GetErrMessage

func (client *BaseClient) GetErrMessage(bodyStr string) map[string]interface{}

func (*BaseClient) GetSecurityToken

func (client *BaseClient) GetSecurityToken() (string, error)

func (*BaseClient) GetSignatureV1

func (client *BaseClient) GetSignatureV1(request *tea.Request, bucketName, accessKeySecret string) string

func (*BaseClient) GetSignatureV2

func (client *BaseClient) GetSignatureV2(request *tea.Request, bucketName, accessKeySecret string, additionalHeaders []string) string

func (*BaseClient) GetSpecialValue

func (client *BaseClient) GetSpecialValue(obj map[string]interface{}, key string) string

Get value from obj according to key

func (*BaseClient) GetUserAgent

func (client *BaseClient) GetUserAgent() string

func (*BaseClient) IfListEmpty

func (client *BaseClient) IfListEmpty(val []string) bool

func (*BaseClient) InitClient

func (client *BaseClient) InitClient(config map[string]interface{}) error

New a client according to config

func (*BaseClient) Inject

func (client *BaseClient) Inject(body io.Reader, ref map[string]string) io.Reader

func (*BaseClient) IsFail

func (client *BaseClient) IsFail(response *tea.Response) bool

Determine whether the request failed

func (*BaseClient) ListToString

func (client *BaseClient) ListToString(a []string, sep string) string

func (*BaseClient) NotNull

func (client *BaseClient) NotNull(obj map[string]interface{}) bool

func (*BaseClient) ParseMeta

func (client *BaseClient) ParseMeta(meta map[string]string, prefix string) map[string]string

Remove prefix from key of meta

func (*BaseClient) ParseUint

func (client *BaseClient) ParseUint(respCrc string, hasRange bool) uint64

Parse string to uint

func (*BaseClient) ParseXml

func (client *BaseClient) ParseXml(val string, result interface{}) map[string]interface{}

Parse Body to map[string]interface{}

func (*BaseClient) ReadAsStream

func (client *BaseClient) ReadAsStream(response *tea.Response) io.ReadCloser

func (*BaseClient) ReadAsString

func (client *BaseClient) ReadAsString(resp *tea.Response) (string, error)

func (*BaseClient) ToHeader

func (client *BaseClient) ToHeader(raw map[string]interface{}) map[string]string

func (*BaseClient) ToMeta

func (client *BaseClient) ToMeta(meta map[string]string, prefix string) map[string]string

Add prefix to key of meta

func (*BaseClient) ToQuery

func (client *BaseClient) ToQuery(filter map[string]interface{}) map[string]string

Parse filter to produce a map[string]string

func (*BaseClient) ToXML

func (client *BaseClient) ToXML(obj map[string]interface{}) string

func (*BaseClient) UrlDecode

func (client *BaseClient) UrlDecode(value string) string

Decryption

type LimitSpeedReader

type LimitSpeedReader struct {
	io.ReadCloser
	// contains filtered or unexported fields
}

LimitSpeedReader for limit bandwidth upload

func (*LimitSpeedReader) Close

func (r *LimitSpeedReader) Close() error

Close ...

func (*LimitSpeedReader) Read

func (r *LimitSpeedReader) Read(p []byte) (n int, err error)

Read

type OssLimiter

type OssLimiter struct {
	// contains filtered or unexported fields
}

OssLimiter wrapper rate.Limiter

func GetOssLimiter

func GetOssLimiter(uploadSpeed int) (ossLimiter *OssLimiter)

GetOssLimiter create OssLimiter uploadSpeed KB/s

type ServiceError

type ServiceError struct {
	Code      string `json:"Code" xml:"Code"`
	Message   string `json:"Message" xml:"Message"`
	RequestId string `json:"RequestId" xml:"RequestId"`
	HostId    string `json:"HostId" xml:"HostId"`
}

ServiceError is for recording error which is caused when sending request

type Sorter

type Sorter struct {
	Keys []string
	Vals []string
}

Sorter defines the key-value structure for storing the sorted data in signHeader.

func (*Sorter) Len

func (hs *Sorter) Len() int

Len is an additional function for function SignHeader.

func (*Sorter) Less

func (hs *Sorter) Less(i, j int) bool

Less is an additional function for function SignHeader.

func (*Sorter) Sort

func (hs *Sorter) Sort()

Sort is an additional function for function SignHeader.

func (*Sorter) Swap

func (hs *Sorter) Swap(i, j int)

Swap is an additional function for function SignHeader.

Jump to

Keyboard shortcuts

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