Add support for populating host ip address.

This commit is contained in:
Brendan Burns
2014-06-17 22:28:44 -07:00
parent 57869958bc
commit 420b2fdd57
8 changed files with 77 additions and 38 deletions

View File

@@ -22,10 +22,10 @@ import (
// CloudInterface is an abstract, pluggable interface for cloud providers
type Interface interface {
// TCPLoadBalancer returns a balancer interface, or nil if none is supported. Returns an error if one occurs.
TCPLoadBalancer() (TCPLoadBalancer, error)
// Instances returns an instances interface, or nil if none is supported. Returns an error if one occurs.
Instances() (Instances, error)
// TCPLoadBalancer returns a balancer interface. Also returns true if the interface is supported, false otherwise.
TCPLoadBalancer() (TCPLoadBalancer, bool)
// Instances returns an instances interface. Also returns true if the interface is supported, false otherwise.
Instances() (Instances, bool)
}
type TCPLoadBalancer interface {

View File

@@ -35,8 +35,12 @@ func (f *FakeCloud) ClearCalls() {
f.Calls = []string{}
}
func (f *FakeCloud) TCPLoadBalancer() (TCPLoadBalancer, error) {
return f, nil
func (f *FakeCloud) TCPLoadBalancer() (TCPLoadBalancer, bool) {
return f, true
}
func (f *FakeCloud) Instances() (Instances, bool) {
return f, true
}
func (f *FakeCloud) TCPLoadBalancerExists(name, region string) (bool, error) {

View File

@@ -79,12 +79,12 @@ func NewGCECloud() (*GCECloud, error) {
}, nil
}
func (gce *GCECloud) TCPLoadBalancer() (TCPLoadBalancer, error) {
return gce, nil
func (gce *GCECloud) TCPLoadBalancer() (TCPLoadBalancer, bool) {
return gce, true
}
func (gce *GCECloud) Instances() (Instances, error) {
return gce, nil
func (gce *GCECloud) Instances() (Instances, bool) {
return gce, true
}
func makeHostLink(projectID, zone, host string) string {