Shifting VIP struct to new package
diff --git a/rackspace/lb/v1/lbs/requests.go b/rackspace/lb/v1/lbs/requests.go
index 0aef0cd..3a9fc25 100644
--- a/rackspace/lb/v1/lbs/requests.go
+++ b/rackspace/lb/v1/lbs/requests.go
@@ -9,6 +9,7 @@
"github.com/rackspace/gophercloud/pagination"
"github.com/rackspace/gophercloud/rackspace/lb/v1"
"github.com/rackspace/gophercloud/rackspace/lb/v1/nodes"
+ "github.com/rackspace/gophercloud/rackspace/lb/v1/vips"
)
// ListOptsBuilder allows extensions to add additional parameters to the
@@ -93,7 +94,7 @@
// Optional - the type of virtual IPs you want associated with the load
// balancer.
- VIPs []VIP
+ VIPs []vips.VIP
// Optional - the access list management feature allows fine-grained network
// access controls to be applied to the load balancer virtual IP address.
diff --git a/rackspace/lb/v1/lbs/requests_test.go b/rackspace/lb/v1/lbs/requests_test.go
index 04c2785..add9d06 100644
--- a/rackspace/lb/v1/lbs/requests_test.go
+++ b/rackspace/lb/v1/lbs/requests_test.go
@@ -5,6 +5,7 @@
"github.com/rackspace/gophercloud/pagination"
"github.com/rackspace/gophercloud/rackspace/lb/v1/nodes"
+ "github.com/rackspace/gophercloud/rackspace/lb/v1/vips"
th "github.com/rackspace/gophercloud/testhelper"
"github.com/rackspace/gophercloud/testhelper/client"
)
@@ -36,8 +37,8 @@
Algorithm: RAND,
Status: ACTIVE,
NodeCount: 3,
- VIPs: []VIP{
- VIP{
+ VIPs: []vips.VIP{
+ vips.VIP{
ID: 403,
Address: "206.55.130.1",
Type: "PUBLIC",
@@ -68,9 +69,9 @@
Name: "a-new-loadbalancer",
Port: 80,
Protocol: "HTTP",
- VIPs: []VIP{
- VIP{ID: 2341},
- VIP{ID: 900001},
+ VIPs: []vips.VIP{
+ vips.VIP{ID: 2341},
+ vips.VIP{ID: 900001},
},
Nodes: []nodes.Node{
nodes.Node{Address: "10.1.1.1", Port: 80, Condition: "ENABLED"},
@@ -100,14 +101,14 @@
Weight: 1,
},
},
- VIPs: []VIP{
- VIP{
+ VIPs: []vips.VIP{
+ vips.VIP{
ID: 39,
Address: "206.10.10.210",
Type: "PUBLIC",
Version: "IPV4",
},
- VIP{
+ vips.VIP{
ID: 900001,
Address: "2001:4801:79f1:0002:711b:be4c:0000:0021",
Type: "PUBLIC",
@@ -161,8 +162,8 @@
Status: ACTIVE,
Timeout: 30,
ConnectionLogging: ConnectionLogging{Enabled: true},
- VIPs: []VIP{
- VIP{
+ VIPs: []vips.VIP{
+ vips.VIP{
ID: 1000,
Address: "206.10.10.210",
Type: "PUBLIC",
diff --git a/rackspace/lb/v1/lbs/results.go b/rackspace/lb/v1/lbs/results.go
index 2feb856..359d8e5 100644
--- a/rackspace/lb/v1/lbs/results.go
+++ b/rackspace/lb/v1/lbs/results.go
@@ -6,6 +6,7 @@
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
"github.com/rackspace/gophercloud/rackspace/lb/v1/nodes"
+ "github.com/rackspace/gophercloud/rackspace/lb/v1/vips"
)
// Protocol represents the network protocol which the load balancer accepts.
@@ -101,14 +102,6 @@
Time string
}
-// VIP - temp
-type VIP struct {
- Address string `json:"address,omitempty"`
- ID int `json:"id,omitempty"`
- Type string `json:"type,omitempty"`
- Version string `json:"ipVersion,omitempty" mapstructure:"ipVersion"`
-}
-
// LoadBalancer represents a load balancer API resource.
type LoadBalancer struct {
// Human-readable name for the load balancer.
@@ -132,7 +125,7 @@
NodeCount int `mapstructure:"nodeCount"`
// Slice of virtual IPs associated with this load balancer.
- VIPs []VIP `mapstructure:"virtualIps"`
+ VIPs []vips.VIP `mapstructure:"virtualIps"`
// Datetime when the LB was created.
Created Datetime
diff --git a/rackspace/lb/v1/vips/results.go b/rackspace/lb/v1/vips/results.go
index 5320e81..51dea3a 100644
--- a/rackspace/lb/v1/vips/results.go
+++ b/rackspace/lb/v1/vips/results.go
@@ -1 +1,9 @@
package vips
+
+// VIP represents a Virtual IP API resource.
+type VIP struct {
+ Address string `json:"address,omitempty"`
+ ID int `json:"id,omitempty"`
+ Type string `json:"type,omitempty"`
+ Version string `json:"ipVersion,omitempty" mapstructure:"ipVersion"`
+}