sureshanaparti commented on code in PR #107:
URL: https://github.com/apache/cloudstack-go/pull/107#discussion_r2149679383


##########
generate/generate.go:
##########
@@ -1752,17 +1755,22 @@ func (s *service) generateNewAPICallFunc(a *API) {
                pn("")
                pn("    // We should be able to retry on failure as this call 
is idempotent")
                pn("    for i := 0; i < 3; i++ {")
-               pn("            resp, err = s.cs.newPostRequest(\"%s\", 
p.toURLValues())", a.Name)
+               pn("            resp, err = s.cs.newRequest(\"%s\", 
p.toURLValues())", a.Name)
                pn("            if err == nil {")
                pn("                    break")
                pn("            }")
                pn("            time.Sleep(500 * time.Millisecond)")
                pn("    }")
        } else {
-               if requiresPostMethod[a.Name] {
+               isGetRequest, _ := 
regexp.MatchString("^(get|list|query|find)(\\w+)+$", strings.ToLower(a.Name))
+               getRequestList := 
map[string]struct{}{"isaccountallowedtocreateofferingswithtags": {}, 
"readyforshutdown": {}, "cloudianisenabled": {}, "quotabalance": {},
+                       "quotasummary": {}, "quotatarifflist": {}, 
"quotaisenabled": {}, "quotastatement": {}, "verifyoauthcodeandgetuser": {}}
+               _, isInGetRequestList := getRequestList[strings.ToLower(a.Name)]
+
+               if requiresPostMethod[a.Name] || !(isGetRequest || 
isInGetRequestList) {
                        pn("    resp, err := s.cs.newPostRequest(\"%s\", 
p.toURLValues())", a.Name)
                } else {
-                       pn("    resp, err := s.cs.newPostRequest(\"%s\", 
p.toURLValues())", a.Name)
+                       pn("    resp, err := s.cs.newRequest(\"%s\", 
p.toURLValues())", a.Name)

Review Comment:
   newRequest, which is GET call



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to