update listApis.json, Quota API, and fixed double url value handling#90
update listApis.json, Quota API, and fixed double url value handling#90tonymmm1 wants to merge 23 commits intoapache:mainfrom
Conversation
|
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"
}, |
|
|
seems to be an issue with generator.go on double types |
|
Fixed the double/float type generation. |
|
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. |
| pn(" Credits []string `json:\"credits\"`") | ||
| pn(" StartDate string `json:\"startdate\"`") | ||
| pn(" Currency string `json:\"currency\"`") | ||
| pn("}") |
There was a problem hiding this comment.
Do we need to add EndDate and EndQuota as well?
|
@tonymmm1 can you deal with the conflict, please? |
…(based on #90) (#98) * listApis.json update * add initial comments for expanding Quota api * implement QuotaBalance * implement QuotaCredits * implement QuotaStatement * implement QuotaSummary * implement QuotaTariffCreate * implement QuotaTariffDelete * implement QuotaTariffList * implemented QuotaTariffUpdate * implemented QuotaUpdate * fix url values * add NewQuotaUpdateParams for QuotaUpdate * add missing quota api functions to layout.go * ran make and it auto updated manual changes to QuotaService.go * fix url value generation for double/float64 types * update generated files * ensure that quotaTariffCreate uses POST * fix types for QuotaService * fix quotaTariffList * add custom quotaStatement response type to match actual cloudstack api response * add custom response type for QuotaBalance * double API definition fixed * add quotaTariffList * regenerate mocks * Update cloudstack/cloudstack.go --------- Co-authored-by: tonymmm1 <tony@mail.magnatox.com>
https://cloudstack.apache.org/api/apidocs-4.19/
Quota api implementation