Modify Create/SetGlobalForwardingRule to just take a link.

This commit is contained in:
Prashanth Balasubramanian 2016-01-26 19:04:59 -08:00
parent cba768322a
commit bcd39900b3

View File

@ -1323,11 +1323,13 @@ func (gce *GCECloud) ListSslCertificates() (*compute.SslCertificateList, error)
// GlobalForwardingRule management // GlobalForwardingRule management
// CreateGlobalForwardingRule creates and returns a GlobalForwardingRule that points to the given TargetHttpProxy. // CreateGlobalForwardingRule creates and returns a GlobalForwardingRule that points to the given TargetHttp(s)Proxy.
func (gce *GCECloud) CreateGlobalForwardingRule(proxy *compute.TargetHttpProxy, name string, portRange string) (*compute.ForwardingRule, error) { // targetProxyLink is the SelfLink of a TargetHttp(s)Proxy.
func (gce *GCECloud) CreateGlobalForwardingRule(targetProxyLink, ip, name, portRange string) (*compute.ForwardingRule, error) {
rule := &compute.ForwardingRule{ rule := &compute.ForwardingRule{
Name: name, Name: name,
Target: proxy.SelfLink, IPAddress: ip,
Target: targetProxyLink,
PortRange: portRange, PortRange: portRange,
IPProtocol: "TCP", IPProtocol: "TCP",
} }
@ -1341,9 +1343,10 @@ func (gce *GCECloud) CreateGlobalForwardingRule(proxy *compute.TargetHttpProxy,
return gce.GetGlobalForwardingRule(name) return gce.GetGlobalForwardingRule(name)
} }
// SetProxyForGlobalForwardingRule links the given TargetHttpProxy with the given GlobalForwardingRule. // SetProxyForGlobalForwardingRule links the given TargetHttp(s)Proxy with the given GlobalForwardingRule.
func (gce *GCECloud) SetProxyForGlobalForwardingRule(fw *compute.ForwardingRule, proxy *compute.TargetHttpProxy) error { // targetProxyLink is the SelfLink of a TargetHttp(s)Proxy.
op, err := gce.service.GlobalForwardingRules.SetTarget(gce.projectID, fw.Name, &compute.TargetReference{Target: proxy.SelfLink}).Do() func (gce *GCECloud) SetProxyForGlobalForwardingRule(fw *compute.ForwardingRule, targetProxyLink string) error {
op, err := gce.service.GlobalForwardingRules.SetTarget(gce.projectID, fw.Name, &compute.TargetReference{Target: targetProxyLink}).Do()
if err != nil { if err != nil {
return err return err
} }