request

package
v2.0.0-alpha.38+incomp... Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder is the request builder for QingCloud service.

func (*Builder) BuildHTTPRequest

func (b *Builder) BuildHTTPRequest(o *data.Operation, i *reflect.Value) (*http.Request, error)

BuildHTTPRequest builds http request with an operation and an input.

type Request

type Request struct {
	Operation *data.Operation
	Input     *reflect.Value
	Output    *reflect.Value

	HTTPRequest  *http.Request
	HTTPResponse *http.Response
}

A Request can build, sign, send and unpack API request.

func New

func New(o *data.Operation, i data.Input, x interface{}) (*Request, error)

New create a Request from given Operation, Input and Output. It returns a Request.

func (*Request) Send

func (r *Request) Send() error

Send sends API request. It returns error if error occurred.

type Signer

type Signer struct {
	AccessKeyID     string
	SecretAccessKey string

	BuiltURL  string
	BuiltForm string
}

Signer is the http request signer for IaaS service.

func (*Signer) BuildSignature

func (is *Signer) BuildSignature(request *http.Request) (string, error)

BuildSignature calculates the signature string.

func (*Signer) BuildStringToSign

func (is *Signer) BuildStringToSign(request *http.Request) (string, error)

BuildStringToSign build the string to sign.

func (*Signer) BuildStringToSignByValues

func (is *Signer) BuildStringToSignByValues(requestDate string, requestMethod string, requestPath string, requestParams url.Values) (string, error)

BuildStringToSignByValues build the string to sign.

func (*Signer) WriteSignature

func (is *Signer) WriteSignature(request *http.Request) error

WriteSignature calculates signature and write it to http request.

type Unpacker

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

Unpacker is the response unpacker.

func (*Unpacker) UnpackHTTPRequest

func (u *Unpacker) UnpackHTTPRequest(o *data.Operation, r *http.Response, x *reflect.Value) error

UnpackHTTPRequest unpack the http response with an operation, http response and an output.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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