@@ -47,22 +47,22 @@ const (
4747
4848 VOLCENGINE_API_VERSION = "2020-04-01"
4949 VOLCENGINE_IAM_API_VERSION = "2018-01-01"
50- VOLCENGINE_OBSERVE_API_VERSION = "2018-01-01"
50+ VOLCENGINE_MONITOR_API_VERSION = "2018-01-01"
5151 VOLCENGINE_BILLING_API_VERSION = "2022-01-01"
5252
5353 VOLCENGINE_API = "open.volcengineapi.com"
5454 VOLCENGINE_IAM_API = "iam.volcengineapi.com"
5555 VOLCENGINE_TOS_API = "tos-cn-beijing.volces.com"
5656 VOLCENGINE_BILLING_API = "billing.volcengineapi.com"
5757
58- VOLCENGINE_SERVICE_ECS = "ecs"
59- VOLCENGINE_SERVICE_VPC = "vpc"
60- VOLCENGINE_SERVICE_NAT = "natgateway"
61- VOLCENGINE_SERVICE_STORAGE = "storage_ebs"
62- VOLCENGINE_SERVICE_IAM = "iam"
63- VOLCENGINE_SERVICE_TOS = "tos"
64- VOLCENGINE_SERVICE_OBSERVICE = "Volc_Observe "
65- VOLCENGINE_SERVICE_BILLING = "billing"
58+ VOLCENGINE_SERVICE_ECS = "ecs"
59+ VOLCENGINE_SERVICE_VPC = "vpc"
60+ VOLCENGINE_SERVICE_NAT = "natgateway"
61+ VOLCENGINE_SERVICE_STORAGE = "storage_ebs"
62+ VOLCENGINE_SERVICE_IAM = "iam"
63+ VOLCENGINE_SERVICE_TOS = "tos"
64+ VOLCENGINE_SERVICE_MONITOR = "cloudmonitor "
65+ VOLCENGINE_SERVICE_BILLING = "billing"
6666
6767 VOLCENGINE_DEFAULT_REGION = "cn-beijing"
6868)
@@ -276,8 +276,8 @@ func (self *sCred) Do(req *http.Request) (*http.Response, error) {
276276}
277277
278278func (client * SVolcEngineClient ) monitorRequest (regionId , apiName string , params map [string ]interface {}) (jsonutils.JSONObject , error ) {
279- cred := client .getSdkCredential (regionId , VOLCENGINE_SERVICE_OBSERVICE , "" )
280- return client .jsonRequest (cred , VOLCENGINE_API , VOLCENGINE_OBSERVE_API_VERSION , apiName , params )
279+ cred := client .getSdkCredential (regionId , VOLCENGINE_SERVICE_MONITOR , "" )
280+ return client .jsonRequest (cred , VOLCENGINE_API , VOLCENGINE_MONITOR_API_VERSION , apiName , params )
281281}
282282
283283func (client * SVolcEngineClient ) jsonRequest (cred sdk.Credentials , domain string , apiVersion string , apiName string , params interface {}) (jsonutils.JSONObject , error ) {
@@ -306,23 +306,20 @@ func (client *SVolcEngineClient) jsonRequest(cred sdk.Credentials, domain string
306306 method = httputils .DELETE
307307 }
308308 }
309- if cred .Service == VOLCENGINE_SERVICE_OBSERVICE {
309+ if cred .Service == VOLCENGINE_SERVICE_MONITOR {
310310 method = httputils .POST
311311 }
312312 // 私网接口仅支持GET请求
313313 if cred .Service == VOLCENGINE_SERVICE_VPC {
314314 method = httputils .GET
315315 }
316316
317- form := url.Values {}
318- _params , _ := params .(map [string ]string )
317+ var reqBody io.Reader = nil
319318 switch method {
320319 case httputils .POST :
321- for k , v := range _params {
322- form .Set (k , v )
323- query .Set (k , v )
324- }
320+ reqBody = strings .NewReader (jsonutils .Marshal (params ).String ())
325321 default :
322+ _params , _ := params .(map [string ]string )
326323 for k , v := range _params {
327324 query .Set (k , v )
328325 }
@@ -333,7 +330,7 @@ func (client *SVolcEngineClient) jsonRequest(cred sdk.Credentials, domain string
333330 return nil , errors .Wrapf (err , "url.Parse" )
334331 }
335332
336- req , err := http .NewRequest (string (method ), u .String (), strings . NewReader ( form . Encode ()) )
333+ req , err := http .NewRequest (string (method ), u .String (), reqBody )
337334 if err != nil {
338335 return nil , errors .Wrapf (err , "NewRequest" )
339336 }
0 commit comments