This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch pr90
in repository https://gitbox.apache.org/repos/asf/cloudstack-go.git

commit e3313bfd9e6b7487e55e53745a417d77cf6beac5
Author: tonymmm1 <t...@mail.magnatox.com>
AuthorDate: Sat Jul 27 12:49:26 2024 -0500

    add custom response type for QuotaBalance
---
 cloudstack/QuotaService.go | 17 ++++++++---------
 generate/generate.go       | 14 ++++++++++++++
 2 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/cloudstack/QuotaService.go b/cloudstack/QuotaService.go
index 1b22026..e3490c5 100644
--- a/cloudstack/QuotaService.go
+++ b/cloudstack/QuotaService.go
@@ -206,15 +206,14 @@ func (s *QuotaService) QuotaBalance(p 
*QuotaBalanceParams) (*QuotaBalanceRespons
 }
 
 type QuotaBalanceResponse 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"`
+       Statement QuotaBalanceResponseType `json:"balance"`
+}
+
+type QuotaBalanceResponseType struct {
+       StartQuota float64  `json:"startquota"`
+       Credits    []string `json:"credits"`
+       StartDate  string   `json:"startdate"`
+       Currency   string   `json:"currency"`
 }
 
 type QuotaCreditsParams struct {
diff --git a/generate/generate.go b/generate/generate.go
index c35b666..9e1c989 100644
--- a/generate/generate.go
+++ b/generate/generate.go
@@ -1902,6 +1902,20 @@ func (s *service) generateResponseType(a *API) {
        tn := capitalize(strings.TrimPrefix(a.Name, "configure") + "Response")
 
        // add custom response types for some specific API calls
+       if a.Name == "quotaBalance" {
+               pn("type QuotaBalanceResponse struct {")
+               pn("    Statement QuotaBalanceResponseType `json:\"balance\"`")
+               pn("}")
+               pn("")
+               pn("type QuotaBalanceResponseType struct {")
+               pn("    StartQuota float64  `json:\"startquota\"`")
+               pn("    Credits    []string `json:\"credits\"`")
+               pn("    StartDate  string   `json:\"startdate\"`")
+               pn("    Currency   string   `json:\"currency\"`")
+               pn("}")
+               pn("")
+               return
+       }
        if a.Name == "quotaStatement" {
                pn("type QuotaStatementResponse struct {")
                pn("    Statement QuotaStatementResponseType 
`json:\"statement\"`")

Reply via email to