Skip to content
Permalink
Browse files
Fix issue #54
This fixes issue #54 by adding some specific tweaks needed to handle
the `listLoadBalancerRuleInstances` response correctly.

Unfortunately the CloudStack API has a few strange corner
cases/inconsistencies that requires specific handling of certain calls.
  • Loading branch information
Sander van Harmelen committed May 2, 2016
1 parent cfbfb48 commit 4200e684038b1c9998f5a513d3a22e3349d2661e
Showing 2 changed files with 8 additions and 3 deletions.
@@ -2008,12 +2008,12 @@ func (s *LoadBalancerService) ListLoadBalancerRuleInstances(p *ListLoadBalancerR

type ListLoadBalancerRuleInstancesResponse struct {
Count int `json:"count"`
LoadBalancerRuleInstances []*LoadBalancerRuleInstance `json:"loadbalancerruleinstance"`
LoadBalancerRuleInstances []*LoadBalancerRuleInstance `json:"lbrulevmidip"`
}

type LoadBalancerRuleInstance struct {
Lbvmipaddresses []string `json:"lbvmipaddresses,omitempty"`
Loadbalancerruleinstance string `json:"loadbalancerruleinstance,omitempty"`
Lbvmipaddresses []string `json:"lbvmipaddresses,omitempty"`
Loadbalancerruleinstance *VirtualMachine `json:"loadbalancerruleinstance,omitempty"`
}

type UpdateLoadBalancerRuleParams struct {
@@ -1081,6 +1081,8 @@ func (s *service) generateResponseType(a *API) {
pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "asyncjobs")
case "listEgressFirewallRules":
pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "firewallrule")
case "listLoadBalancerRuleInstances":
pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "lbrulevmidip")
case "registerTemplate":
pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "template")
default:
@@ -1226,6 +1228,9 @@ func mapType(t string) string {
return "map[string]string"
case "responseobject":
return "json.RawMessage"
case "uservmresponse":
// This is a really specific abnormaly of the API
return "*VirtualMachine"
default:
return "string"
}

0 comments on commit 4200e68

Please sign in to comment.