Merge pull request #7669 from a-robinson/lb

Change the cloud provider TCPLoadBalancerExists function to GetTCPLoadBalancer...
This commit is contained in:
Quinton Hoole
2015-05-05 11:42:06 -07:00
6 changed files with 36 additions and 35 deletions

View File

@@ -239,16 +239,16 @@ func (gce *GCECloud) waitForRegionOp(op *compute.Operation, region string) error
return nil
}
// TCPLoadBalancerExists is an implementation of TCPLoadBalancer.TCPLoadBalancerExists.
func (gce *GCECloud) TCPLoadBalancerExists(name, region string) (bool, error) {
_, err := gce.service.ForwardingRules.Get(gce.projectID, region, name).Do()
// GetTCPLoadBalancer is an implementation of TCPLoadBalancer.GetTCPLoadBalancer
func (gce *GCECloud) GetTCPLoadBalancer(name, region string) (endpoint string, exists bool, err error) {
fw, err := gce.service.ForwardingRules.Get(gce.projectID, region, name).Do()
if err == nil {
return true, nil
return fw.IPAddress, true, nil
}
if isHTTPErrorCode(err, http.StatusNotFound) {
return false, nil
return "", false, nil
}
return false, err
return "", false, err
}
func isHTTPErrorCode(err error, code int) bool {