Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.

Commit

Permalink
Merge pull request #15 from aokumasan/fix/bug_of_describe_load_balanc…
Browse files Browse the repository at this point in the history
…er_params

Fix bug of cannot describe load balancer with name
  • Loading branch information
aokumasan authored Dec 5, 2019
2 parents 171ade8 + 508367b commit bce166d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions private/protocol/computing/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,24 @@ func Build(r *request.Request) {
parameterLength := reflect.ValueOf(r.Params).Elem().FieldByName("LoadBalancerNames").Len()
prefix := "LoadBalancerNames"
for i := 1; i <= parameterLength; i++ {
body[fmt.Sprintf("%s.LoadBalancerPort.%d", prefix, i)] = body[fmt.Sprintf("%s.member.%d.LoadBalancerPort", prefix, i)]
body[fmt.Sprintf("%s.InstancePort.%d", prefix, i)] = body[fmt.Sprintf("%s.member.%d.InstancePort", prefix, i)]
body[fmt.Sprintf("%s.member.%d", prefix, i)] = body[fmt.Sprintf("%s.member.%d.LoadBalancerName", prefix, i)]
delete(body, fmt.Sprintf("%s.member.%d.LoadBalancerPort", prefix, i))
delete(body, fmt.Sprintf("%s.member.%d.InstancePort", prefix, i))
delete(body, fmt.Sprintf("%s.member.%d.LoadBalancerName", prefix, i))
loadBalancerNameKey := fmt.Sprintf("%s.member.%d.LoadBalancerName", prefix, i)
loadBalancerPortKey := fmt.Sprintf("%s.member.%d.LoadBalancerPort", prefix, i)
instancePortKey := fmt.Sprintf("%s.member.%d.InstancePort", prefix, i)
loadBalancerName := body.Get(loadBalancerNameKey)
loadBalancerPort := body.Get(loadBalancerPortKey)
instancePort := body.Get(instancePortKey)
if loadBalancerName != "" {
body.Set(fmt.Sprintf("%s.member.%d", prefix, i), loadBalancerName)
body.Del(loadBalancerNameKey)
}
if loadBalancerPort != "" {
body.Set(fmt.Sprintf("%s.LoadBalancerPort.%d", prefix, i), loadBalancerPort)
body.Del(loadBalancerPortKey)
}
if instancePort != "" {
body.Set(fmt.Sprintf("%s.InstancePort.%d", prefix, i), instancePort)
body.Del(instancePortKey)
}
}
}

Expand Down

0 comments on commit bce166d

Please sign in to comment.