common

package
v0.0.0-...-d999168 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestMethodGET  = "GET"
	RequestMethodPOST = "POST"

	SignatureMethodHMacSha256 = "HmacSHA256"
)
View Source
const (
	NoErr         = 0
	NoErrCodeDesc = "Success"

	ErrQCloudGoClient = 9999
)

Variables

This section is empty.

Functions

func EncodeStruct

func EncodeStruct(i interface{}, v *url.Values) error

Types

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(credential CredentialInterface, opts Opts) (*Client, error)

func (*Client) Invoke

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

func (*Client) InvokeWithGET

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

func (*Client) InvokeWithPOST

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

type ClientError

type ClientError struct {
	Message string
}

func (ClientError) Error

func (ce ClientError) Error() string

type Credential

type Credential struct {
	SecretId  string
	SecretKey string
}

func (Credential) GetSecretId

func (cred Credential) GetSecretId() (string, error)

func (Credential) GetSecretKey

func (cred Credential) GetSecretKey() (string, error)

func (Credential) Values

func (cred Credential) Values() (CredentialValues, error)

type CredentialInterface

type CredentialInterface interface {
	GetSecretId() (string, error)
	GetSecretKey() (string, error)

	Values() (CredentialValues, error)
}

type CredentialValues

type CredentialValues map[string]string

type LegacyAPIError

type LegacyAPIError struct {
	Code     int    `json:"code"`
	Message  string `json:"message"`
	CodeDesc string `json:"codeDesc"`
}

func (LegacyAPIError) Error

func (lae LegacyAPIError) Error() string

type Opts

type Opts struct {
	Method          string
	Region          string
	Host            string
	Path            string
	SignatureMethod string
	Schema          string

	Logger *logrus.Logger
}

type QCloudArg

type QCloudArg interface {
	EncodeStructWithPrefix(prefix string, val reflect.Value, v *url.Values) error
}

type VersionAPIError

type VersionAPIError struct {
	Response struct {
		Error apiErrorResponse `json:"Error"`
	} `json:"Response"`
}

func (VersionAPIError) Error

func (vae VersionAPIError) Error() string

Jump to

Keyboard shortcuts

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