|
|
|
@@ -25,7 +25,8 @@ func (c *Client) GetClusterInfo(req GetClusterInfoReq) ([]ClusterDetail, error) |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
resp, err := http2.PostJSON(targetUrl, http2.RequestParam{Body: req}) |
|
|
|
//resp, err := http2.PostJSON(targetUrl, http2.RequestParam{Body: req}) |
|
|
|
resp, err := http2.PostJSON(targetUrl, http2.RequestParam{}) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
@@ -37,8 +38,17 @@ func (c *Client) GetClusterInfo(req GetClusterInfoReq) ([]ClusterDetail, error) |
|
|
|
return nil, fmt.Errorf("parsing response: %w", err) |
|
|
|
} |
|
|
|
|
|
|
|
// 该接口传入参数后查询效率很低,所以需要在这里特殊处理 |
|
|
|
if codeResp.Code == ResponseCodeOK { |
|
|
|
return codeResp.Data, nil |
|
|
|
var results []ClusterDetail |
|
|
|
for _, cluster := range codeResp.Data { |
|
|
|
for _, id := range req.IDs { |
|
|
|
if cluster.ClusterId == id { |
|
|
|
results = append(results, cluster) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return results, nil |
|
|
|
} |
|
|
|
|
|
|
|
return nil, codeResp.ToError() |
|
|
|
|