ucloud / ucloud-sdk-go Goto Github PK
View Code? Open in Web Editor NEWUCloud SDK for Golang
Home Page: https://docs.ucloud.cn/opensdk-go/README
License: Apache License 2.0
UCloud SDK for Golang
Home Page: https://docs.ucloud.cn/opensdk-go/README
License: Apache License 2.0
API already exists, but not implemented by sdk?
API does not exist, could you provide?
自己写实在太麻烦了, 要浏览器抓url. 抓实现方法
cfg := ucloud.NewConfig()
cfg.Region = "cn-bj2"
cred := auth.NewCredential()
cred.PublicKey = "*******"
cred.PrivateKey = "*********"
var (
sslPubPath = "/etc/nginx/certs/fenghong.tech/fullchain.cer"
sslKeyPath = "/etc/nginx/certs/fenghong.tech/cert.fenghong.key"
)
// 获取ssl key
bufPubKey, _ := ioutil.ReadFile(sslPubPath)
bufPriKey, _ := ioutil.ReadFile(sslKeyPath)
pubKey := string(bufPubKey)
priKey := string(bufPriKey)
client := ucloud.NewClient(&cfg, &cred)
reqs := client.NewGenericRequest()
reqs.SetAction("AddCertificate")
// 构造prams
ssl := make(map[string]interface{}, 5)
// 这个projectId也是浏览器抓到的..
ssl["ProjectId"] = "*** "
ssl["CertName"] = "testApi"
ssl["UserCert"] = pubKey
ssl["PrivateKey"] = priKey
reqs.SetPayload(ssl)
resp, err := client.GenericInvoke(reqs)
if err != nil {
fmt.Println("[ERROR]", err)
return
}
fmt.Println("[RESPONSE]", resp)
什么时候sdk写好哇..
Please add your requirements of UCloud API at here.
eg.
API Name
We will push it forward as soon as posible.
我看到文档里面有,但是没有在这里面找到,想问一下这个功能sdk没有提供么
在 CreateUHostInstanceRequest struct 的定义中没有 CpuPlatform这个参数,在使用CreateUHostInstance创建主机的时候不能指定具体型号,只能使用默认 CPU 型号 Intel,不能使用 Amd。
你好,我在使用你们提供的计费接口DescribeOrderInfo进行费用拉取,想在原有的sdk基础之上添加,仿照代码风格新建了一个模块ubiling:client.go, types_ubillings_order_infos.go,
describe_order_detail_info.go ,types_ubillings_resource_tag.go,调试的时候发现在ucloud/client.go的第93行,
// use response middle to build and convert response when response has been created. // such as retry, report traceback, print log and etc. for _, handler := range c.responseHandlers { resp, err = handler(c, req, resp, err) }
所返回的resp并不是response.CommonBase的格式,我在这之前,
body := httpResp.GetBody() for _, patch := range patches { body = patch.Patch(body) } fmt.Println(body) fmt.Println(string(body))
将http真正返回的body部分,打印出来,是包含orderInfo的正确的返回值;
但是在main.go中 采用以下代码,
`cfg, credential := loadConfig()
ubillingClient := ubillings.NewClient(cfg, credential)
req := ubillingClient.NewDescribeOrderDetailInfoRequest()
req.BeginTime = 1539417292
req.EndTime = 1542095692
req.SetRegion("kr-seoul-01")
req.Limit= 100
newUBilling, err := ubillingClient.DescribeOrderDetailInfo(req)
if err != nil {
fmt.Println(err)
}
fmt.Println(newUBilling.OrderInfo)`
打印为空
ps: 目前计费部分的sdk我已经写完,有需要的话可以review,merge一下。
来自:ucloud用户的反馈
请问 创建主机和创建EIP的接口是否都已经达到生产可使用了
v0.21.47
go version
)?go1.19.2
DescribeShareBandwidthPriceResponse 中的 TotalPrice 应该是 float
[{"Action":"DescribeShareBandwidthPriceResponse","ListPrice":0.2,"PurchaseValue":1669563557,"Request_uuid":"0dcdfb21-2ab4-4ae1-9ea6-168a8e3761e9","RetCode":0,"TotalPrice":0.2}] got error, json: cannot unmarshal number 0.2 into Go struct field DescribeShareBandwidthPriceResponse.TotalPrice of type int
If you have have an runnable example, please include it.
写个半成品, 有毛用.
我看了一下 SDK的签名计算方法 https://github.com/ucloud/ucloud-sdk-go/blob/master/ucloud/auth/credential.go#L44
想请问一下数组型参数签名怎么计算?
我看了一下,ucloud的签名计算方法,代码上有一点我有疑问,
https://github.com/ucloud/ucloud-sdk-go/blob/master/ucloud/auth/credential.go#L30
如果publicKey里面有= 怎么办?
when i use python/go,there isn't package in ucloud-sdk-python3/go, but the example in ucloud website of api tutorial shows that it should have the umon module.
0.22.18
go version
)?1.22.3
type DescribeEIPResponse struct {
response.CommonBase
// 外网IP数组
Infos[] EIPInfo
// 返回信息描述
Message string
// 返回现有外网IP总数
Totalcount int
}
=>
type DescribeEIPResponse struct {
response.CommonBase
// 外网IP数组
EIPSet[] EIPInfo
// 返回信息描述
Message string
// 返回现有外网IP总数
Totalcount int
}
Infos => EIPSet //建议你们都对比以下resp的字段名称,太多问题了
If you have have an runnable example, please include it.
// PrintfT("开始执行")
region := "hk"
zone := "hk-02"
orderEID := ""
newEID := ""
resourceID := ""
cfg := ucloud.NewConfig()
cfg.Region = region
cfg.BaseUrl = "https://api.ucloud.cn"
credential := auth.NewCredential()
credential.PublicKey = ucloudPublic
credential.PrivateKey = ucloudPrivate
uhostClient := ucloudstack.NewClient(&cfg, &credential)
describeEIPReq := uhostClient.NewDescribeEIPRequest()
describeEIPReq.Region = ucloud.String(region)
describeEIPReq.Zone = ucloud.String(zone)
// describeEIPReq.ip
// send request
describeEIPResp, err := uhostClient.DescribeEIP(describeEIPReq)
if err != nil {
fmt.Printf("something bad happened: %s\n", err)
return
}
fmt.Printf("Describe EIP Success, Infos: %+v", describeEIPResp.Infos)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.