QcloudApi

package module
v0.0.0-...-35785a1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 13 Imported by: 12

README

qcloud_sign_golang

Qcloud API 调试工具 Golang 版

下载

go get github.com/QcloudApi/qcloud_sign_golang

使用

package main

import(
    "fmt"
    "os"
    "encoding/json"
    "github.com/QcloudApi/qcloud_sign_golang"
)

func main() {
    // 替换实际的 SecretId 和 SecretKey
    secretId := "YOUR_SECRET_ID"
    secretKey := "YOUR_SECRET_KEY"

    // 配置
    config := map[string]interface{} {"secretId" : secretId, "secretKey" : secretKey, "debug" : false}

    // 请求参数
    params := map[string]interface{} {"Region" : "hk", "Action" : "DescribeInstances"}

    // 发送请求
    retData, err := QcloudApi.SendRequest("cvm", params, config)
    if err != nil{
        fmt.Print("Error.", err)
        return
    }

    // 解析 Json 字符串
    var jsonObj interface{}
    err = json.Unmarshal([]byte(retData), &jsonObj)
    if err != nil {
        fmt.Println(err);
        return
    }
    // 打印 Json
    jsonOut, _ := json.MarshalIndent(jsonObj, "", "  ");
    b2 := append(jsonOut, '\n')
    os.Stdout.Write(b2)

    return
}

Documentation

Overview

============================================================================= # # FileName: QcloudApi.go # Desc: Qcloud 签名工具 Golang 版 # # Author: gavinyao # Email: gavinyao@tencent.com # # Created: 2014-12-22 21:11:37 # Version: 0.0.1 # History: # 0.0.1 | gavinyao | 2014-12-22 21:11:37 | initialization # =============================================================================

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendRequest

func SendRequest(mod string, params map[string]interface{}, config map[string]interface{}) (retData string, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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