goqcloud

package module
v0.0.0-...-b00e0b0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2018 License: MIT Imports: 11 Imported by: 0

README

Tencent Cloud SDK for go

GoDoc Widget Go Report Card

Generated form Tencent Cloud API docs

How to

  • run make to generate all clients
package main

import (
    "os"
    "fmt"
    "time"

    "github.com/morlay/goqcloud"
    "github.com/morlay/goqcloud/clients/cvm"
)

func main() {
    client := goqcloud.NewClientWithCredential(
        os.Getenv("TENCENTCLOUD_SECRET_ID"),
        os.Getenv("TENCENTCLOUD_SECRET_KEY"),

        // optional config timeout
        goqcloud.ClientOptionWithTimeout(1 * time.Hour),
        // log each request        
        goqcloud.ClientOptionWithTransports(
        	goqcloud.NewLogTransport(),
        	// or define your own transport
        ),
    )
    
    req := cvm.DescribeInstancesRequest{
        Region: "cn-beijing",
    }
    
    resp, err := req.Invoke(client)
    
    if err != nil {
        panic(err)
    }
    
    fmt.Printf("%v", resp.InstanceSet)
}

Rules

  • required field will not be pointer

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogTransport

func NewLogTransport() transform.Transport

Types

type Client

type Client interface {
	Request(service string, action string, version string) RequestSender
}

type ClientOption

type ClientOption struct {
	Timeout    time.Duration
	Transports []transform.Transport
}

func ClientOptionWithTimeout

func ClientOptionWithTimeout(timeout time.Duration) *ClientOption

func ClientOptionWithTransports

func ClientOptionWithTransports(transports ...transform.Transport) *ClientOption

func ComposeClientOptions

func ComposeClientOptions(opts ...*ClientOption) *ClientOption

type ClientWithCredential

type ClientWithCredential struct {
	*ClientOption
	signature.Credential
}

func NewClientWithCredential

func NewClientWithCredential(secretId, secretKey string, opts ...*ClientOption) *ClientWithCredential

func (*ClientWithCredential) Request

func (c *ClientWithCredential) Request(service string, action string, version string) RequestSender

type LogTransport

type LogTransport struct {
	NextRoundTripper http.RoundTripper
}

func (*LogTransport) RoundTrip

func (t *LogTransport) RoundTrip(request *http.Request) (*http.Response, error)

type MaybeErrorResponse

type MaybeErrorResponse interface {
	GetError() error
}

type RequestSender

type RequestSender interface {
	Do(req interface{}, resp interface{}) error
}

type TencentCloudBaseResponse

type TencentCloudBaseResponse struct {
	RequestId string             `json:"RequestId"`
	Error     *TencentCloudError `json:"Error,omitempty"`
}

func (*TencentCloudBaseResponse) GetError

func (resp *TencentCloudBaseResponse) GetError() error

type TencentCloudError

type TencentCloudError struct {
	Code    string `json:"Code"`
	Message string `json:"Message"`
}

func NewTencentCloudError

func NewTencentCloudError(code string, msg string) *TencentCloudError

func (*TencentCloudError) Error

func (e *TencentCloudError) Error() string

type TencentCloudResponse

type TencentCloudResponse struct {
	Response interface{} `json:"Response"`
}

Jump to

Keyboard shortcuts

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