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


##########
cloudstack/UserService.go:
##########
@@ -3133,7 +3133,7 @@ func (s *UserService) 
NewVerifyOAuthCodeAndGetUserParams(provider string) *Verif
 
 // Verify the OAuth Code and fetch the corresponding user from provider
 func (s *UserService) VerifyOAuthCodeAndGetUser(p 
*VerifyOAuthCodeAndGetUserParams) (*VerifyOAuthCodeAndGetUserResponse, error) {
-       resp, err := s.cs.newPostRequest("verifyOAuthCodeAndGetUser", 
p.toURLValues())
+       resp, err := s.cs.newRequest("verifyOAuthCodeAndGetUser", 
p.toURLValues())

Review Comment:
   should this be changed ?
   
   @sureshanaparti 



##########
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:
   newPostRequest or newRequest ?
   @sureshanaparti 



##########
generate/requiredParams.go:
##########
@@ -49,7 +49,11 @@ var requiredParams = map[string][]string{
                "displaytext",
        },
        "createVPC": {
+               "name",
                "displaytext",
+               "vpcofferingid",
+               "zoneid",
+               "cidr",

Review Comment:
   actually only need to add `cidr` 
   but no issues if add others (`name`, `zoneid`, `vpcofferingid`)



-- 
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