@@ -30,6 +30,7 @@ import (
30
30
"os"
31
31
"os/exec"
32
32
"path"
33
+ "regexp"
33
34
"sort"
34
35
"strings"
35
36
"unicode"
@@ -578,6 +579,8 @@ func (as *allServices) GeneralCode() ([]byte, error) {
578
579
pn (" params.Set(\" apiKey\" , cs.apiKey)" )
579
580
pn (" params.Set(\" command\" , api)" )
580
581
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))" )
581
584
pn ("" )
582
585
pn (" // Generate signature for API call" )
583
586
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) {
1752
1755
pn ("" )
1753
1756
pn (" // We should be able to retry on failure as this call is idempotent" )
1754
1757
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 )
1756
1759
pn (" if err == nil {" )
1757
1760
pn (" break" )
1758
1761
pn (" }" )
1759
1762
pn (" time.Sleep(500 * time.Millisecond)" )
1760
1763
pn (" }" )
1761
1764
} 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 ) {
1763
1771
pn (" resp, err := s.cs.newPostRequest(\" %s\" , p.toURLValues())" , a .Name )
1764
1772
} 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 )
1766
1774
}
1767
1775
}
1768
1776
pn (" if err != nil {" )
0 commit comments