@@ -30,6 +30,7 @@ import (
3030 "os"
3131 "os/exec"
3232 "path"
33+ "regexp"
3334 "sort"
3435 "strings"
3536 "unicode"
@@ -578,6 +579,8 @@ func (as *allServices) GeneralCode() ([]byte, error) {
578579 pn (" params.Set(\" apiKey\" , cs.apiKey)" )
579580 pn (" params.Set(\" command\" , api)" )
580581 pn (" params.Set(\" response\" , \" json\" )" )
582+ pn (" params.Set(\" signatureversion\" , \" 3\" )" )
583+ pn (" params.Set(\" expires\" , time.Now().UTC().Add(15*time.Minute).Format(time.RFC3339))" )
581584 pn ("" )
582585 pn (" // Generate signature for API call" )
583586 pn (" // * Serialize parameters, URL encoding only values and sort them by key, done by EncodeValues" )
@@ -1752,17 +1755,22 @@ func (s *service) generateNewAPICallFunc(a *API) {
17521755 pn ("" )
17531756 pn (" // We should be able to retry on failure as this call is idempotent" )
17541757 pn (" for i := 0; i < 3; i++ {" )
1755- pn (" resp, err = s.cs.newPostRequest (\" %s\" , p.toURLValues())" , a .Name )
1758+ pn (" resp, err = s.cs.newRequest (\" %s\" , p.toURLValues())" , a .Name )
17561759 pn (" if err == nil {" )
17571760 pn (" break" )
17581761 pn (" }" )
17591762 pn (" time.Sleep(500 * time.Millisecond)" )
17601763 pn (" }" )
17611764 } else {
1762- if requiresPostMethod [a .Name ] {
1765+ isGetRequest , _ := regexp .MatchString ("^(get|list|query|find)(\\ w+)+$" , strings .ToLower (a .Name ))
1766+ getRequestList := map [string ]struct {}{"isaccountallowedtocreateofferingswithtags" : {}, "readyforshutdown" : {}, "cloudianisenabled" : {}, "quotabalance" : {},
1767+ "quotasummary" : {}, "quotatarifflist" : {}, "quotaisenabled" : {}, "quotastatement" : {}, "verifyoauthcodeandgetuser" : {}}
1768+ _ , isInGetRequestList := getRequestList [strings .ToLower (a .Name )]
1769+
1770+ if requiresPostMethod [a .Name ] || ! (isGetRequest || isInGetRequestList ) {
17631771 pn (" resp, err := s.cs.newPostRequest(\" %s\" , p.toURLValues())" , a .Name )
17641772 } else {
1765- pn (" resp, err := s.cs.newPostRequest (\" %s\" , p.toURLValues())" , a .Name )
1773+ pn (" resp, err := s.cs.newRequest (\" %s\" , p.toURLValues())" , a .Name )
17661774 }
17671775 }
17681776 pn (" if err != nil {" )
0 commit comments