base

package
v1.0.179 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 28 Imported by: 57

Documentation

Index

Constants

View Source
const (
	RegionCnNorth1    = "cn-north-1"
	RegionUsEast1     = "us-east-1"
	RegionApSingapore = "ap-singapore-1"

	RegionApSouthEast1 = "ap-southeast-1"
)
View Source
const (
	StatementEffectAllow = "Allow"
	StatementEffectDeny  = "Deny"
)
View Source
const SDKName = "volc-sdk-golang"
View Source
const SDKVersion = "v1.0.179"

Variables

This section is empty.

Functions

func ToUrlValues

func ToUrlValues(i interface{}) (values url.Values)

func UnmarshalResultInto

func UnmarshalResultInto(data []byte, result interface{}) error

Types

type ApiInfo

type ApiInfo struct {
	Method  string
	Path    string
	Query   url.Values
	Form    url.Values
	Timeout time.Duration
	Header  http.Header
	Retry   RetrySettings
}

type BaseResp

type BaseResp struct {
	Status      string
	CreatedTime int64
	UpdatedTime int64
}

type Client

type Client struct {
	Client        *http.Client
	ServiceInfo   *ServiceInfo
	ApiInfoList   map[string]*ApiInfo
	CustomTimeout time.Duration
}

Client

func NewClient

func NewClient(info *ServiceInfo, apiInfoList map[string]*ApiInfo) *Client

NewClient

func (*Client) CtxJson

func (client *Client) CtxJson(ctx context.Context, api string, query url.Values, body string) ([]byte, int, error)

func (*Client) CtxJsonThumb added in v1.0.153

func (client *Client) CtxJsonThumb(ctx context.Context, api string, apiInfo *ApiInfo, query url.Values, body []byte) ([]byte, int, error)

func (*Client) CtxMultiPart

func (client *Client) CtxMultiPart(ctx context.Context, api string, query url.Values, form []*MultiPartItem) ([]byte, int, error)

func (*Client) CtxPost

func (client *Client) CtxPost(ctx context.Context, api string, query url.Values, form url.Values) ([]byte, int, error)

CtxPost Initiate a Post request

func (*Client) CtxPostWithContentType

func (client *Client) CtxPostWithContentType(ctx context.Context, api string, query url.Values, body string, ct string) ([]byte, int, error)

CtxPostWithContentType Initiate a post request with a custom Content-Type, Content-Type cannot be empty

func (*Client) CtxQuery

func (client *Client) CtxQuery(ctx context.Context, api string, query url.Values) ([]byte, int, error)

func (*Client) CtxQueryThumb added in v1.0.153

func (client *Client) CtxQueryThumb(ctx context.Context, api string, apiInfo *ApiInfo, query url.Values) ([]byte, int, error)

func (*Client) GetSignUrl

func (client *Client) GetSignUrl(api string, query url.Values) (string, error)

GetSignUrl

func (*Client) Json

func (client *Client) Json(api string, query url.Values, body string) ([]byte, int, error)

Json Initiate a Json post request

func (*Client) Post

func (client *Client) Post(api string, query url.Values, form url.Values) ([]byte, int, error)

func (*Client) PostWithContentType

func (client *Client) PostWithContentType(api string, query url.Values, body string, ct string) ([]byte, int, error)

func (*Client) Query

func (client *Client) Query(api string, query url.Values) ([]byte, int, error)

Query Initiate a Get query request

func (*Client) SetAccessKey

func (client *Client) SetAccessKey(ak string)

SetAccessKey

func (*Client) SetCredential

func (client *Client) SetCredential(c Credentials)

SetCredential

func (*Client) SetCustomTimeout added in v1.0.121

func (client *Client) SetCustomTimeout(timeout time.Duration)

func (*Client) SetHost

func (client *Client) SetHost(host string)

SetHost

func (*Client) SetRetrySettings

func (client *Client) SetRetrySettings(retrySettings *RetrySettings)

SetRetrySettings

func (*Client) SetScheme

func (client *Client) SetScheme(scheme string)

func (*Client) SetSecretKey

func (client *Client) SetSecretKey(sk string)

SetSecretKey

func (*Client) SetSessionToken

func (client *Client) SetSessionToken(token string)

SetSessionToken

func (*Client) SetTimeout

func (client *Client) SetTimeout(timeout time.Duration)

func (*Client) SignSts2

func (client *Client) SignSts2(inlinePolicy *Policy, expire time.Duration) (*SecurityToken2, error)

SignSts2

type CommonResponse

type CommonResponse struct {
	ResponseMetadata ResponseMetadata
	Result           interface{} `json:"Result,omitempty"`
}

Unified JSON return results

type Credentials

type Credentials struct {
	AccessKeyID     string
	SecretAccessKey string
	Service         string
	Region          string
	SessionToken    string
}

func (Credentials) Clone

func (cred Credentials) Clone() Credentials

func (Credentials) Sign

func (c Credentials) Sign(request *http.Request) *http.Request

func (Credentials) SignUrl

func (c Credentials) SignUrl(request *http.Request) string

type ErrorObj

type ErrorObj struct {
	CodeN   int
	Code    string
	Message string
}

type InnerToken

type InnerToken struct {
	LTAccessKeyId         string
	AccessKeyId           string
	SignedSecretAccessKey string
	ExpiredTime           int64
	PolicyString          string
	Signature             string
}

type MultiPartItem

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

func CreateMultiPartItem

func CreateMultiPartItem(header textproto.MIMEHeader, data io.Reader) *MultiPartItem

func CreateMultiPartItemFormField

func CreateMultiPartItemFormField(fieldname string, data string) *MultiPartItem

func CreateMultiPartItemFormFile

func CreateMultiPartItemFormFile(fieldname, filename string, data io.Reader) *MultiPartItem

type Policy

type Policy struct {
	Statement []*Statement
}

type RequestParam

type RequestParam struct {
	IsSignUrl bool
	Body      []byte
	Method    string
	Date      time.Time
	Path      string
	Host      string
	QueryList url.Values
	Headers   http.Header
}

type ResponseMetadata

type ResponseMetadata struct {
	RequestId string
	Service   string    `json:",omitempty"`
	Region    string    `json:",omitempty"`
	Action    string    `json:",omitempty"`
	Version   string    `json:",omitempty"`
	Error     *ErrorObj `json:",omitempty"`
}

type RetrySettings

type RetrySettings struct {
	AutoRetry     bool
	RetryTimes    *uint64
	RetryInterval *time.Duration
}

type SecurityToken2

type SecurityToken2 struct {
	AccessKeyID     string
	SecretAccessKey string
	SessionToken    string
	ExpiredTime     string
	CurrentTime     string
}

type ServiceInfo

type ServiceInfo struct {
	Timeout     time.Duration
	Scheme      string
	Host        string
	Header      http.Header
	Credentials Credentials
	Retry       RetrySettings
}

func (*ServiceInfo) Clone

func (serviceInfo *ServiceInfo) Clone() *ServiceInfo

type SignRequest

type SignRequest struct {
	XDate          string
	XNotSignBody   string
	XCredential    string
	XAlgorithm     string
	XSignedHeaders string
	XSignedQueries string
	XSignature     string
	XSecurityToken string

	Host           string
	ContentType    string
	XContentSha256 string
	Authorization  string
}

func GetSignRequest

func GetSignRequest(requestParam RequestParam, credentials Credentials) SignRequest

type Statement

type Statement struct {
	Effect    string
	Action    []string
	Resource  []string
	Condition string `json:",omitempty"`
}

func NewAllowStatement

func NewAllowStatement(actions, resources []string) *Statement

func NewDenyStatement

func NewDenyStatement(actions, resources []string) *Statement

Jump to

Keyboard shortcuts

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