This is an automated email from the ASF dual-hosted git repository. abh1sar pushed a commit to branch fix-metrics in repository https://gitbox.apache.org/repos/asf/cloudstack-go.git
commit 9225aaf29c2dd6b184a9830e5ce183066348af38 Author: Abhisar Sinha <[email protected]> AuthorDate: Tue Aug 4 20:45:14 2026 +0530 Fix JSON tag mismatch for metrics list responses Add generator cases for listClustersMetrics, listHostsMetrics, listVolumesMetrics, and listZonesMetrics so their response tags match the live server keys (cluster, host, volume, zone) and survive regeneration. Restructure listUsageServerMetrics into a single-object response tagged usageMetrics, matching the actual server payload shape instead of the previous list/count shape that never matched. --- cloudstack/ClusterService.go | 2 +- cloudstack/HostService.go | 2 +- cloudstack/UsageService.go | 3 +-- cloudstack/VolumeService.go | 2 +- cloudstack/ZoneService.go | 2 +- generate/generate.go | 14 ++++++++++++++ 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/cloudstack/ClusterService.go b/cloudstack/ClusterService.go index 1e10470..e16583d 100644 --- a/cloudstack/ClusterService.go +++ b/cloudstack/ClusterService.go @@ -2686,7 +2686,7 @@ func (s *ClusterService) ListClustersMetrics(p *ListClustersMetricsParams) (*Lis type ListClustersMetricsResponse struct { Count int `json:"count"` - ClustersMetrics []*ClustersMetric `json:"clustersmetric"` + ClustersMetrics []*ClustersMetric `json:"cluster"` } type ClustersMetric struct { diff --git a/cloudstack/HostService.go b/cloudstack/HostService.go index 16f9009..07cd9a8 100644 --- a/cloudstack/HostService.go +++ b/cloudstack/HostService.go @@ -4118,7 +4118,7 @@ func (s *HostService) ListHostsMetrics(p *ListHostsMetricsParams) (*ListHostsMet type ListHostsMetricsResponse struct { Count int `json:"count"` - HostsMetrics []*HostsMetric `json:"hostsmetric"` + HostsMetrics []*HostsMetric `json:"host"` } type HostsMetric struct { diff --git a/cloudstack/UsageService.go b/cloudstack/UsageService.go index ef89ced..f15c91d 100644 --- a/cloudstack/UsageService.go +++ b/cloudstack/UsageService.go @@ -2128,8 +2128,7 @@ func (s *UsageService) ListUsageServerMetrics(p *ListUsageServerMetricsParams) ( } type ListUsageServerMetricsResponse struct { - Count int `json:"count"` - UsageServerMetrics []*UsageServerMetric `json:"usageservermetric"` + UsageServerMetrics UsageServerMetric `json:"usageMetrics"` } type UsageServerMetric struct { diff --git a/cloudstack/VolumeService.go b/cloudstack/VolumeService.go index c9158aa..cb85b7a 100644 --- a/cloudstack/VolumeService.go +++ b/cloudstack/VolumeService.go @@ -4466,7 +4466,7 @@ func (s *VolumeService) ListVolumesMetrics(p *ListVolumesMetricsParams) (*ListVo type ListVolumesMetricsResponse struct { Count int `json:"count"` - VolumesMetrics []*VolumesMetric `json:"volumesmetric"` + VolumesMetrics []*VolumesMetric `json:"volume"` } type VolumesMetric struct { diff --git a/cloudstack/ZoneService.go b/cloudstack/ZoneService.go index 8ae1e10..7da52ce 100644 --- a/cloudstack/ZoneService.go +++ b/cloudstack/ZoneService.go @@ -3076,7 +3076,7 @@ func (s *ZoneService) ListZonesMetrics(p *ListZonesMetricsParams) (*ListZonesMet type ListZonesMetricsResponse struct { Count int `json:"count"` - ZonesMetrics []*ZonesMetric `json:"zonesmetric"` + ZonesMetrics []*ZonesMetric `json:"zone"` } type ZonesMetric struct { diff --git a/generate/generate.go b/generate/generate.go index 448b614..08b444e 100644 --- a/generate/generate.go +++ b/generate/generate.go @@ -2032,6 +2032,20 @@ func (s *service) generateResponseType(a *API) { pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "managementserver") case "listDbMetrics": pn(" %s %s `json:\"%s\"`", ln, parseSingular(ln), "dbMetrics") + case "listUsageServerMetrics": + pn(" %s %s `json:\"%s\"`", ln, parseSingular(ln), "usageMetrics") + case "listClustersMetrics": + pn(" Count int `json:\"count\"`") + pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "cluster") + case "listHostsMetrics": + pn(" Count int `json:\"count\"`") + pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "host") + case "listVolumesMetrics": + pn(" Count int `json:\"count\"`") + pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "volume") + case "listZonesMetrics": + pn(" Count int `json:\"count\"`") + pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "zone") case "registerTemplate": pn(" Count int `json:\"count\"`") pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "template")
