Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update listApis.json, Quota API, and fixed double url value handling #90

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

tonymmm1
Copy link

@tonymmm1 tonymmm1 commented Jul 22, 2024

@tonymmm1
Copy link
Author

tonymmm1 commented Jul 22, 2024

Requesting a review to check any mistakes/issues in implementation. @vishesh92 @mlsorensen

@tonymmm1
Copy link
Author

I noticed that the listApis.json was missing the api functions.

@tonymmm1
Copy link
Author

tonymmm1 commented Jul 24, 2024

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"
    },

@tonymmm1 tonymmm1 changed the title work on expanding Quota api update listApis.json and update Quota API Jul 24, 2024
@tonymmm1
Copy link
Author

tonymmm1 commented Jul 24, 2024

# 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

@tonymmm1
Copy link
Author

seems to be an issue with generator.go on double types

@tonymmm1
Copy link
Author

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

@tonymmm1 tonymmm1 changed the title update listApis.json and update Quota API update listApis.json, Quota API, and fixed double url value handling Jul 24, 2024
@tonymmm1
Copy link
Author

tonymmm1 commented Jul 27, 2024

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?

@tonymmm1
Copy link
Author

tonymmm1 commented Jul 27, 2024

Implemented response type overrides for quotaBalance and quotaStatement that should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant