mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-05-06 21:52:54 +08:00
fix(cloudmon): update volc api (#24424)
This commit is contained in:
2
go.mod
2
go.mod
@@ -105,7 +105,7 @@ require (
|
||||
k8s.io/cri-api v0.28.15
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
moul.io/http2curl/v2 v2.3.0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20260311024036-ffafb5789466
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20260311083221-764f2af6b1a5
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0
|
||||
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1
|
||||
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
|
||||
|
||||
4
go.sum
4
go.sum
@@ -1740,8 +1740,8 @@ sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20260311024036-ffafb5789466 h1:UaY8bkI2AvOOzCXUguMxUwO/m/+MBKFnzr+Szy8nHzg=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20260311024036-ffafb5789466/go.mod h1:aWRX5Phwz3nbHUNnIAm1oVogjguXPYDDgCOy/9Hnnvk=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20260311083221-764f2af6b1a5 h1:TPGkjDvC8838VOQvEdGl80zVFPu6DWEYXRl38C6NvDs=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20260311083221-764f2af6b1a5/go.mod h1:aWRX5Phwz3nbHUNnIAm1oVogjguXPYDDgCOy/9Hnnvk=
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0 h1:msG4SiDSVU7CrXH06WuHlNEZXIooTcmNbfrIGHuIHBU=
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
|
||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -2491,7 +2491,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
|
||||
# sigs.k8s.io/yaml v1.3.0
|
||||
## explicit; go 1.12
|
||||
sigs.k8s.io/yaml
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20260311024036-ffafb5789466
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20260311083221-764f2af6b1a5
|
||||
## explicit; go 1.24
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
|
||||
35
vendor/yunion.io/x/cloudmux/pkg/multicloud/volcengine/volcengine.go
generated
vendored
35
vendor/yunion.io/x/cloudmux/pkg/multicloud/volcengine/volcengine.go
generated
vendored
@@ -47,7 +47,7 @@ const (
|
||||
|
||||
VOLCENGINE_API_VERSION = "2020-04-01"
|
||||
VOLCENGINE_IAM_API_VERSION = "2018-01-01"
|
||||
VOLCENGINE_OBSERVE_API_VERSION = "2018-01-01"
|
||||
VOLCENGINE_MONITOR_API_VERSION = "2018-01-01"
|
||||
VOLCENGINE_BILLING_API_VERSION = "2022-01-01"
|
||||
|
||||
VOLCENGINE_API = "open.volcengineapi.com"
|
||||
@@ -55,14 +55,14 @@ const (
|
||||
VOLCENGINE_TOS_API = "tos-cn-beijing.volces.com"
|
||||
VOLCENGINE_BILLING_API = "billing.volcengineapi.com"
|
||||
|
||||
VOLCENGINE_SERVICE_ECS = "ecs"
|
||||
VOLCENGINE_SERVICE_VPC = "vpc"
|
||||
VOLCENGINE_SERVICE_NAT = "natgateway"
|
||||
VOLCENGINE_SERVICE_STORAGE = "storage_ebs"
|
||||
VOLCENGINE_SERVICE_IAM = "iam"
|
||||
VOLCENGINE_SERVICE_TOS = "tos"
|
||||
VOLCENGINE_SERVICE_OBSERVICE = "Volc_Observe"
|
||||
VOLCENGINE_SERVICE_BILLING = "billing"
|
||||
VOLCENGINE_SERVICE_ECS = "ecs"
|
||||
VOLCENGINE_SERVICE_VPC = "vpc"
|
||||
VOLCENGINE_SERVICE_NAT = "natgateway"
|
||||
VOLCENGINE_SERVICE_STORAGE = "storage_ebs"
|
||||
VOLCENGINE_SERVICE_IAM = "iam"
|
||||
VOLCENGINE_SERVICE_TOS = "tos"
|
||||
VOLCENGINE_SERVICE_MONITOR = "cloudmonitor"
|
||||
VOLCENGINE_SERVICE_BILLING = "billing"
|
||||
|
||||
VOLCENGINE_DEFAULT_REGION = "cn-beijing"
|
||||
)
|
||||
@@ -276,8 +276,8 @@ func (self *sCred) Do(req *http.Request) (*http.Response, error) {
|
||||
}
|
||||
|
||||
func (client *SVolcEngineClient) monitorRequest(regionId, apiName string, params map[string]interface{}) (jsonutils.JSONObject, error) {
|
||||
cred := client.getSdkCredential(regionId, VOLCENGINE_SERVICE_OBSERVICE, "")
|
||||
return client.jsonRequest(cred, VOLCENGINE_API, VOLCENGINE_OBSERVE_API_VERSION, apiName, params)
|
||||
cred := client.getSdkCredential(regionId, VOLCENGINE_SERVICE_MONITOR, "")
|
||||
return client.jsonRequest(cred, VOLCENGINE_API, VOLCENGINE_MONITOR_API_VERSION, apiName, params)
|
||||
}
|
||||
|
||||
func (client *SVolcEngineClient) jsonRequest(cred sdk.Credentials, domain string, apiVersion string, apiName string, params interface{}) (jsonutils.JSONObject, error) {
|
||||
@@ -306,7 +306,7 @@ func (client *SVolcEngineClient) jsonRequest(cred sdk.Credentials, domain string
|
||||
method = httputils.DELETE
|
||||
}
|
||||
}
|
||||
if cred.Service == VOLCENGINE_SERVICE_OBSERVICE {
|
||||
if cred.Service == VOLCENGINE_SERVICE_MONITOR {
|
||||
method = httputils.POST
|
||||
}
|
||||
// 私网接口仅支持GET请求
|
||||
@@ -314,15 +314,12 @@ func (client *SVolcEngineClient) jsonRequest(cred sdk.Credentials, domain string
|
||||
method = httputils.GET
|
||||
}
|
||||
|
||||
form := url.Values{}
|
||||
_params, _ := params.(map[string]string)
|
||||
var reqBody io.Reader = nil
|
||||
switch method {
|
||||
case httputils.POST:
|
||||
for k, v := range _params {
|
||||
form.Set(k, v)
|
||||
query.Set(k, v)
|
||||
}
|
||||
reqBody = strings.NewReader(jsonutils.Marshal(params).String())
|
||||
default:
|
||||
_params, _ := params.(map[string]string)
|
||||
for k, v := range _params {
|
||||
query.Set(k, v)
|
||||
}
|
||||
@@ -333,7 +330,7 @@ func (client *SVolcEngineClient) jsonRequest(cred sdk.Credentials, domain string
|
||||
return nil, errors.Wrapf(err, "url.Parse")
|
||||
}
|
||||
|
||||
req, err := http.NewRequest(string(method), u.String(), strings.NewReader(form.Encode()))
|
||||
req, err := http.NewRequest(string(method), u.String(), reqBody)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "NewRequest")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user