Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cloudstack/UserService.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Comment thread
sureshanaparti marked this conversation as resolved.
if err != nil {
return nil, err
}
Expand Down
5 changes: 3 additions & 2 deletions cloudstack/VPCService.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type VPCServiceIface interface {
CreateStaticRoute(p *CreateStaticRouteParams) (*CreateStaticRouteResponse, error)
NewCreateStaticRouteParams(cidr string, gatewayid string) *CreateStaticRouteParams
CreateVPC(p *CreateVPCParams) (*CreateVPCResponse, error)
NewCreateVPCParams(displaytext string, name string, vpcofferingid string, zoneid string) *CreateVPCParams
NewCreateVPCParams(cidr string, displaytext string, name string, vpcofferingid string, zoneid string) *CreateVPCParams
CreateVPCOffering(p *CreateVPCOfferingParams) (*CreateVPCOfferingResponse, error)
NewCreateVPCOfferingParams(displaytext string, name string) *CreateVPCOfferingParams
DeletePrivateGateway(p *DeletePrivateGatewayParams) (*DeletePrivateGatewayResponse, error)
Expand Down Expand Up @@ -1045,9 +1045,10 @@ func (p *CreateVPCParams) GetZoneid() (string, bool) {

// You should always use this function to get a new CreateVPCParams instance,
// as then you are sure you have configured all required params
func (s *VPCService) NewCreateVPCParams(displaytext string, name string, vpcofferingid string, zoneid string) *CreateVPCParams {
func (s *VPCService) NewCreateVPCParams(cidr string, displaytext string, name string, vpcofferingid string, zoneid string) *CreateVPCParams {
p := &CreateVPCParams{}
p.p = make(map[string]interface{})
p.p["cidr"] = cidr
p.p["displaytext"] = displaytext
p.p["name"] = name
p.p["vpcofferingid"] = vpcofferingid
Expand Down
8 changes: 4 additions & 4 deletions cloudstack/VPCService_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"os"
"os/exec"
"path"
"regexp"
"sort"
"strings"
"unicode"
Expand Down Expand Up @@ -578,6 +579,8 @@ func (as *allServices) GeneralCode() ([]byte, error) {
pn(" params.Set(\"apiKey\", cs.apiKey)")
pn(" params.Set(\"command\", api)")
pn(" params.Set(\"response\", \"json\")")
pn(" params.Set(\"signatureversion\", \"3\")")
pn(" params.Set(\"expires\", time.Now().UTC().Add(15*time.Minute).Format(time.RFC3339))")
pn("")
pn(" // Generate signature for API call")
pn(" // * Serialize parameters, URL encoding only values and sort them by key, done by EncodeValues")
Expand Down Expand Up @@ -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)
Comment thread
sureshanaparti marked this conversation as resolved.
}
}
pn(" if err != nil {")
Expand Down
4 changes: 4 additions & 0 deletions generate/requiredParams.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ var requiredParams = map[string][]string{
"displaytext",
},
"createVPC": {
"name",
"displaytext",
"vpcofferingid",
"zoneid",
"cidr",
Comment thread
sureshanaparti marked this conversation as resolved.
},
"createVPCOffering": {
"displaytext",
Expand Down
2 changes: 1 addition & 1 deletion test/VPCService_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestVPCService(t *testing.T) {
if _, ok := response["createVPC"]; !ok {
t.Skipf("Skipping as no json response is provided in testdata")
}
p := client.VPC.NewCreateVPCParams("displaytext", "name", "vpcofferingid", "zoneid")
p := client.VPC.NewCreateVPCParams("cidr", "displaytext", "name", "vpcofferingid", "zoneid")
r, err := client.VPC.CreateVPC(p)
if err != nil {
t.Errorf(err.Error())
Expand Down