Code Monkey home page Code Monkey logo

jdcloud-sdk-go's People

Contributors

eeslook avatar jdcloud-apigateway avatar lidaobing avatar lixuenan2333 avatar shijunlee avatar tanc009 avatar wdwqw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jdcloud-sdk-go's Issues

允许用户使用自定义的http.Client?

如下的代码中使用了硬编码的http.Client,能否使其允许调用方可以传递自定义的http.Client?

func (c JDCloudClient) doSend(method, url, data string, header map[string]string, timeout time.Duration, sign SignFunc) ([]byte, error) {
	client := &http.Client{Timeout: timeout}

	req, err := http.NewRequest(method, url, strings.NewReader(data))
	// ... 
}

core bug

github.com/jdcloud-api/jdcloud-sdk-go/core/Signer.go:170:11: assignment mismatch: 2 variables but 1 values

json: cannot unmarshal number into Go struct field BatchSendResult.result.code of type string

京东云文本短信产品,调用批量发送短信方法时遇到响应异常
Unmarshal json failed, resp: %s {"result":{"code":11561102,"data":null,"message":"批量发送短信接口,未找到模板ID对应的数据。","status":false},"requestId":"58ac9346cfda4ec0a118b4eb5b10df5e"}
响应结果result.code为int类型,但是struct定义类型为string类型,最终解析失败
请开发者核实

core错误依旧

jdcloud-api/jdcloud-sdk-go/core/Signer.go:170:11: assignment mismatch: 2 variables but 1 values

仔细看了一下Signer.go以及它调用的github.com/satori/go.uuid,uuid.NewV4()返回一个参数但,Signer.go中接收参数为2,

需要切换依赖的 uuid 包

$ go1.12.5 run monitor.go 
# github.com/jdcloud-api/jdcloud-sdk-go/core
../../../go/pkg/mod/github.com/jdcloud-api/[email protected]/core/Signer.go:170:11: assignment mismatch: 2 variables but uuid.NewV4 returns 1 values

原因:

  1. go 1.11之后推荐使用 go mod 来管理你的包,go mod 会优先寻找稳定版,即 tag 好的版本
  2. go.uuid 包的稳定版本和master版本接口不一致
  3. 建议切换到 https://github.com/gofrs/uuid

如何关闭api中包含的输出

执行vpc操作时出现如下输出
Content-Type [application/json]
User-Agent [JdcloudSdkGo/1.1.2 vpc/0.5.0]
DEBUG: Request Signature:
---[ CANONICAL STRING ]-----------------------------
GET
/v1/regions/cn-east-2/networkInterfaces/port-pig3p7864x

content-type:application/json
host:vpc.jdcloud-api.com
x-jdcloud-date:20181208T003651Z
x-jdcloud-nonce:32844190-ff6d-4fa1-a1bb-072ce645a26a

content-type;host;x-jdcloud-date;x-jdcloud-nonce
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
---[ STRING TO SIGN ]--------------------------------
JDCLOUD2-HMAC-SHA256
20181208T003651Z
20181208/cn-east-2/vpc/jdcloud2_request
da043a14395e577ccf589507812d01e009116bbe9864dd2b771257996b205e06

{"URL":"/regions/{regionId}/networkInterfaces/{networkInterfaceId}","Method":"GET","Header":null,"Version":"v1","regionId":"cn-east-2","networkInterfaceId":"port-fet9c4pvzt"}
URL=/regions/cn-east-2/networkInterfaces/port-fet9c4pvzt
Content-Type [application/json]
User-Agent [JdcloudSdkGo/1.1.2 vpc/0.5.0]
DEBUG: Request Signature:
---[ CANONICAL STRING ]-----------------------------
GET
/v1/regions/cn-east-2/networkInterfaces/port-fet9c4pvzt

content-type:application/json
host:vpc.jdcloud-api.com
x-jdcloud-date:20181208T003651Z
x-jdcloud-nonce:3d15d3e1-bf3a-40c5-8b75-364c0c442cf4

content-type;host;x-jdcloud-date;x-jdcloud-nonce
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
---[ STRING TO SIGN ]--------------------------------
JDCLOUD2-HMAC-SHA256
20181208T003651Z
20181208/cn-east-2/vpc/jdcloud2_request
0145832b415881d025f6279da73a5c9c58668c4a5e45bdb73a41f310a83fdaf4

如何关闭以下输出?

文档太简单了,哥老官

  1. service 目录下,分别是什么组件?
  2. 我想遍历 IP 或者获取 IP 信息,应该用哪个 service,找不到啊

oss client call function failed

参考oss_test.go文件,调用client的相关接口ListBuckets(req)或者HeadBucket(req),均返回失败。返回错误提示信息:"invalid character '<' looking for beginning of value",不太明白这个返回信息具体是什么意思.与此同时我测试了vm client函数调用,功能基本正常。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.