Skip to content
Permalink
Browse files
Merge pull request #127 from nettoclaudio/fix/send-resourcetags-sorted
Present map API type in a predictable order
  • Loading branch information
svanharmelen committed Mar 31, 2020
2 parents f0c20be + fd791a0 commit bc6cdc7c37e55960b527c5484fb403c9dea1710d
Showing 28 changed files with 226 additions and 276 deletions.
@@ -128,11 +128,10 @@ func (p *CreateAccountParams) toURLValues() url.Values {
u.Set("account", v.(string))
}
if v, found := p.p["accountdetails"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("accountdetails[%d].key", i), k)
u.Set(fmt.Sprintf("accountdetails[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("accountdetails[%d].value", i), m[k])
}
}
if v, found := p.p["accountid"]; found {
@@ -1834,11 +1833,10 @@ func (p *UpdateAccountParams) toURLValues() url.Values {
u.Set("account", v.(string))
}
if v, found := p.p["accountdetails"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("accountdetails[%d].key", i), k)
u.Set(fmt.Sprintf("accountdetails[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("accountdetails[%d].value", i), m[k])
}
}
if v, found := p.p["domainid"]; found {
@@ -362,11 +362,10 @@ func (p *ListPublicIpAddressesParams) toURLValues() url.Values {
u.Set("state", v.(string))
}
if v, found := p.p["tags"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("tags[%d].key", i), k)
u.Set(fmt.Sprintf("tags[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("tags[%d].value", i), m[k])
}
}
if v, found := p.p["vlanid"]; found {
@@ -332,11 +332,10 @@ func (p *CreateAutoScaleVmProfileParams) toURLValues() url.Values {
u.Set("autoscaleuserid", v.(string))
}
if v, found := p.p["counterparam"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("counterparam[%d].key", i), k)
u.Set(fmt.Sprintf("counterparam[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("counterparam[%d].value", i), m[k])
}
}
if v, found := p.p["destroyvmgraceperiod"]; found {
@@ -2658,11 +2657,10 @@ func (p *UpdateAutoScaleVmProfileParams) toURLValues() url.Values {
u.Set("autoscaleuserid", v.(string))
}
if v, found := p.p["counterparam"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("counterparam[%d].key", i), k)
u.Set(fmt.Sprintf("counterparam[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("counterparam[%d].value", i), m[k])
}
}
if v, found := p.p["customid"]; found {
@@ -1277,11 +1277,10 @@ func (p *ListEgressFirewallRulesParams) toURLValues() url.Values {
u.Set("projectid", v.(string))
}
if v, found := p.p["tags"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("tags[%d].key", i), k)
u.Set(fmt.Sprintf("tags[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("tags[%d].value", i), m[k])
}
}
return u
@@ -1527,11 +1526,10 @@ func (p *ListFirewallRulesParams) toURLValues() url.Values {
u.Set("projectid", v.(string))
}
if v, found := p.p["tags"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("tags[%d].key", i), k)
u.Set(fmt.Sprintf("tags[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("tags[%d].value", i), m[k])
}
}
return u
@@ -1900,11 +1898,10 @@ func (p *ListPortForwardingRulesParams) toURLValues() url.Values {
u.Set("projectid", v.(string))
}
if v, found := p.p["tags"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("tags[%d].key", i), k)
u.Set(fmt.Sprintf("tags[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("tags[%d].value", i), m[k])
}
}
return u
@@ -34,11 +34,10 @@ func (p *AddGuestOsParams) toURLValues() url.Values {
return u
}
if v, found := p.p["details"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("details[%d].key", i), k)
u.Set(fmt.Sprintf("details[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("details[%d].value", i), m[k])
}
}
if v, found := p.p["name"]; found {
@@ -968,11 +967,10 @@ func (p *UpdateGuestOsParams) toURLValues() url.Values {
return u
}
if v, found := p.p["details"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("details[%d].key", i), k)
u.Set(fmt.Sprintf("details[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("details[%d].value", i), m[k])
}
}
if v, found := p.p["id"]; found {
@@ -980,11 +980,10 @@ func (p *ListIsosParams) toURLValues() url.Values {
u.Set("showremoved", vv)
}
if v, found := p.p["tags"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("tags[%d].key", i), k)
u.Set(fmt.Sprintf("tags[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("tags[%d].value", i), m[k])
}
}
if v, found := p.p["zoneid"]; found {
@@ -1649,10 +1648,9 @@ func (p *UpdateIsoParams) toURLValues() url.Values {
u.Set("cleanupdetails", vv)
}
if v, found := p.p["details"]; found {
i := 0
for k, vv := range v.(map[string]string) {
u.Set(fmt.Sprintf("details[%d].%s", i, k), vv)
i++
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("details[%d].%s", i, k), m[k])
}
}
if v, found := p.p["displaytext"]; found {
@@ -34,11 +34,10 @@ func (p *AddImageStoreParams) toURLValues() url.Values {
return u
}
if v, found := p.p["details"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("details[%d].key", i), k)
u.Set(fmt.Sprintf("details[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("details[%d].value", i), m[k])
}
}
if v, found := p.p["name"]; found {
@@ -322,11 +321,10 @@ func (p *CreateSecondaryStagingStoreParams) toURLValues() url.Values {
return u
}
if v, found := p.p["details"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("details[%d].key", i), k)
u.Set(fmt.Sprintf("details[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("details[%d].value", i), m[k])
}
}
if v, found := p.p["provider"]; found {
@@ -1045,11 +1043,10 @@ func (p *UpdateCloudToUseObjectStoreParams) toURLValues() url.Values {
return u
}
if v, found := p.p["details"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("details[%d].key", i), k)
u.Set(fmt.Sprintf("details[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("details[%d].value", i), m[k])
}
}
if v, found := p.p["name"]; found {
@@ -193,11 +193,10 @@ func (p *ImportLdapUsersParams) toURLValues() url.Values {
u.Set("account", v.(string))
}
if v, found := p.p["accountdetails"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("accountdetails[%d].key", i), k)
u.Set(fmt.Sprintf("accountdetails[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("accountdetails[%d].value", i), m[k])
}
}
if v, found := p.p["accounttype"]; found {
@@ -517,11 +516,10 @@ func (p *LdapCreateAccountParams) toURLValues() url.Values {
u.Set("account", v.(string))
}
if v, found := p.p["accountdetails"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("accountdetails[%d].key", i), k)
u.Set(fmt.Sprintf("accountdetails[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("accountdetails[%d].value", i), m[k])
}
}
if v, found := p.p["accountid"]; found {
@@ -296,11 +296,10 @@ func (p *AssignToGlobalLoadBalancerRuleParams) toURLValues() url.Values {
return u
}
if v, found := p.p["gslblbruleweightsmap"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("gslblbruleweightsmap[%d].key", i), k)
u.Set(fmt.Sprintf("gslblbruleweightsmap[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("gslblbruleweightsmap[%d].value", i), m[k])
}
}
if v, found := p.p["id"]; found {
@@ -401,11 +400,10 @@ func (p *AssignToLoadBalancerRuleParams) toURLValues() url.Values {
u.Set("virtualmachineids", vv)
}
if v, found := p.p["vmidipmap"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("vmidipmap[%d].key", i), k)
u.Set(fmt.Sprintf("vmidipmap[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("vmidipmap[%d].value", i), m[k])
}
}
return u
@@ -1016,11 +1014,10 @@ func (p *CreateLBStickinessPolicyParams) toURLValues() url.Values {
u.Set("name", v.(string))
}
if v, found := p.p["param"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("param[%d].key", i), k)
u.Set(fmt.Sprintf("param[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("param[%d].value", i), m[k])
}
}
return u
@@ -2137,11 +2134,10 @@ func (p *ListGlobalLoadBalancerRulesParams) toURLValues() url.Values {
u.Set("regionid", vv)
}
if v, found := p.p["tags"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("tags[%d].key", i), k)
u.Set(fmt.Sprintf("tags[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("tags[%d].value", i), m[k])
}
}
return u
@@ -2926,11 +2922,10 @@ func (p *ListLoadBalancerRulesParams) toURLValues() url.Values {
u.Set("publicipid", v.(string))
}
if v, found := p.p["tags"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("tags[%d].key", i), k)
u.Set(fmt.Sprintf("tags[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("tags[%d].value", i), m[k])
}
}
if v, found := p.p["virtualmachineid"]; found {
@@ -3267,11 +3262,10 @@ func (p *ListLoadBalancersParams) toURLValues() url.Values {
u.Set("sourceipaddressnetworkid", v.(string))
}
if v, found := p.p["tags"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("tags[%d].key", i), k)
u.Set(fmt.Sprintf("tags[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("tags[%d].value", i), m[k])
}
}
return u
@@ -3935,11 +3929,10 @@ func (p *RemoveFromLoadBalancerRuleParams) toURLValues() url.Values {
u.Set("virtualmachineids", vv)
}
if v, found := p.p["vmidipmap"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("vmidipmap[%d].key", i), k)
u.Set(fmt.Sprintf("vmidipmap[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("vmidipmap[%d].value", i), m[k])
}
}
return u
@@ -838,11 +838,10 @@ func (p *ListNetworkACLsParams) toURLValues() url.Values {
u.Set("protocol", v.(string))
}
if v, found := p.p["tags"]; found {
i := 0
for k, vv := range v.(map[string]string) {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
u.Set(fmt.Sprintf("tags[%d].key", i), k)
u.Set(fmt.Sprintf("tags[%d].value", i), vv)
i++
u.Set(fmt.Sprintf("tags[%d].value", i), m[k])
}
}
if v, found := p.p["traffictype"]; found {

0 comments on commit bc6cdc7

Please sign in to comment.