update listApis.json, Quota API, and fixed double url value handling
https://cloudstack.apache.org/api/apidocs-4.19/
Quota api implementation
Requesting a review to check any mistakes/issues in implementation. @vishesh92 @mlsorensen
I noticed that the listApis.json was missing the api functions.
quotaUpdate that was generated has additional response fields in the struct when the documentation states it should only show "updated_on".
type QuotaUpdateResponse struct {
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Updated_on string `json:"updated_on"`
}
However the new listApis.json from cloudmonkey cli seems to show more fields than the documentation. So documentation might be a bit stale.
{
"description": "Update quota calculations, alerts and statements",
"isasync": false,
"name": "quotaUpdate",
"params": [],
"related": "",
"response": [
{},
{},
{
"description": "the current status of the latest async job acting on this object",
"name": "jobstatus",
"type": "integer"
},
{
"description": "timestamp when the run got over",
"name": "updated_on",
"type": "date"
},
{
"description": "the UUID of the latest async job acting on this object",
"name": "jobid",
"type": "string"
}
],
"since": "4.7.0"
},
# github.com/apache/cloudstack-go/v2/cloudstack
cloudstack/QuotaService.go:235:5: v declared and not used
cloudstack/QuotaService.go:241:5: v declared and not used
cloudstack/QuotaService.go:849:5: v declared and not used
cloudstack/QuotaService.go:1418:5: v declared and not used
FAIL github.com/apache/cloudstack-go/v2/cloudstack [build failed]
FAIL github.com/apache/cloudstack-go/v2/examples [build failed]
? github.com/apache/cloudstack-go/v2/generate [no test files]
FAIL github.com/apache/cloudstack-go/v2/test [build failed]
FAIL
seems to be an issue with generator.go on double types
Fixed the double/float type generation.
==================================================================
Random Seed: 1721788077
Will run 4 of 4 specs
••••
Ran 4 of 4 Specs in 0.000 seconds
SUCCESS! -- 4 Passed | 0 Failed | 0 Pending | 0 Skipped
--- PASS: TestEncodeValues (0.00s)
=== RUN TestUUID
--- PASS: TestUUID (0.00s)
PASS
ok github.com/apache/cloudstack-go/v2/test 0.044s
As of cloudstack 14.19.0.2 it seems like the quotaBalance response object does not match listApis.json from cmk-cli.
Is the object I am receiving from cloudstack api.
{
"quotabalanceresponse": {
"balance": {
"startquota": 0,
"credits": [],
"startdate": "2024-07-27T11:32:15-0500",
"currency": "$"
}
}
}
Is the generated type.
type QuotaBalanceResponse struct {
QuotaBalance []*QuotaBalance `json:"balance"`
}
type QuotaBalance struct {
Account string `json:"account"`
Accountid int64 `json:"accountid"`
Domain int64 `json:"domain"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Name string `json:"name"`
Quota float64 `json:"quota"`
Type int `json:"type"`
Unit string `json:"unit"`
}
There seems to be no correlation between these types?
Implemented response type overrides for quotaBalance and quotaStatement that should work.
@tonymmm1 can you deal with the conflict, please?
@tonymmm1 , I rebased your code in PR #98 . please have a quick review if you can.