diff --git a/cloudstack/BackupService.go b/cloudstack/BackupService.go index 1a00485..92033d8 100644 --- a/cloudstack/BackupService.go +++ b/cloudstack/BackupService.go @@ -922,8 +922,7 @@ func (p *CreateVMFromBackupParams) toURLValues() url.Values { if v, found := p.p["userdatadetails"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { - u.Set(fmt.Sprintf("userdatadetails[%d].key", i), k) - u.Set(fmt.Sprintf("userdatadetails[%d].value", i), m[k]) + u.Set(fmt.Sprintf("userdatadetails[%d].%s", i, k), m[k]) } } if v, found := p.p["userdataid"]; found { diff --git a/cloudstack/VirtualMachineService.go b/cloudstack/VirtualMachineService.go index 80f6521..675b5c8 100644 --- a/cloudstack/VirtualMachineService.go +++ b/cloudstack/VirtualMachineService.go @@ -11450,7 +11450,7 @@ func (s *VirtualMachineService) ListVirtualMachinesUsageHistory(p *ListVirtualMa type ListVirtualMachinesUsageHistoryResponse struct { Count int `json:"count"` - VirtualMachinesUsageHistory []*VirtualMachinesUsageHistory `json:"virtualmachinesusagehistory"` + VirtualMachinesUsageHistory []*VirtualMachinesUsageHistory `json:"virtualmachine"` } type VirtualMachinesUsageHistory struct { diff --git a/generate/generate.go b/generate/generate.go index 9ba9bc8..448b614 100644 --- a/generate/generate.go +++ b/generate/generate.go @@ -2076,6 +2076,9 @@ func (s *service) generateResponseType(a *API) { case "listSecondaryStorageSelectors": pn(" Count int `json:\"count\"`") pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "heuristics") + case "listVirtualMachinesUsageHistory": + pn(" Count int `json:\"count\"`") + pn(" VirtualMachinesUsageHistory []*VirtualMachinesUsageHistory `json:\"virtualmachine\"`") case "listHostHAResources": pn(" Count int `json:\"count\"`") pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "hostha") diff --git a/test/testdata/VirtualMachineService.json b/test/testdata/VirtualMachineService.json index d0f36a3..0347d0b 100644 --- a/test/testdata/VirtualMachineService.json +++ b/test/testdata/VirtualMachineService.json @@ -505,5 +505,67 @@ "completed": "2021-10-13T04:54:56+0000", "jobid": "f9a9af61-47ea-4fb7-acc9-93ea50f12042" } + }, + "listVirtualMachinesUsageHistory": { + "listvirtualmachinesusagehistoryresponse": { + "count": 1, + "virtualmachine": [ + { + "id": "4f6d7879-8e9d-40cb-9390-28924a31df78", + "name": "i-5-39-VM", + "displayname": "ubuntu-01", + "stats": [ + { + "timestamp": "2024-12-31T17:54:37+0600", + "cpuused": "55.56%", + "diskioread": 0, + "diskiowrite": 0, + "diskiopstotal": 0, + "diskkbsread": 0, + "diskkbswrite": 0, + "memoryintfreekbs": 182168, + "memorykbs": 1048576, + "memorytargetkbs": 1048576, + "networkkbsread": 0, + "networkkbswrite": 0, + "networkread": "0.00 MiB", + "networkwrite": "0.00 MiB" + }, + { + "timestamp": "2024-12-31T17:54:37+0600", + "cpuused": "0.2%", + "diskioread": 0, + "diskiowrite": 0, + "diskiopstotal": 0, + "diskkbsread": 0, + "diskkbswrite": 0, + "memoryintfreekbs": 182168, + "memorykbs": 1048576, + "memorytargetkbs": 1048576, + "networkkbsread": 0, + "networkkbswrite": 0, + "networkread": "0.00 MiB", + "networkwrite": "0.00 MiB" + }, + { + "timestamp": "2024-12-31T17:54:37+0600", + "cpuused": "11.43%", + "diskioread": 0, + "diskiowrite": 0, + "diskiopstotal": 0, + "diskkbsread": 0, + "diskkbswrite": 0, + "memoryintfreekbs": 182168, + "memorykbs": 1048576, + "memorytargetkbs": 1048576, + "networkkbsread": 0, + "networkkbswrite": 0, + "networkread": "0.00 MiB", + "networkwrite": "0.00 MiB" + } + ] + } + ] + } } -} \ No newline at end of file +}