Touching up docs
diff --git a/rackspace/lb/v1/lbs/fixtures.go b/rackspace/lb/v1/lbs/fixtures.go
index 64ec3c5..4c497e4 100644
--- a/rackspace/lb/v1/lbs/fixtures.go
+++ b/rackspace/lb/v1/lbs/fixtures.go
@@ -209,10 +209,7 @@
"persistenceType": "HTTP_COOKIE"
},
"connectionThrottle": {
- "minConnections": 10,
- "maxConnections": 100,
- "maxConnectionRate": 50,
- "rateInterval": 60
+ "maxConnections": 100
},
"cluster": {
"name": "c1.dfw1"
diff --git a/rackspace/lb/v1/lbs/requests.go b/rackspace/lb/v1/lbs/requests.go
index 6e1d614..a26e8ce 100644
--- a/rackspace/lb/v1/lbs/requests.go
+++ b/rackspace/lb/v1/lbs/requests.go
@@ -8,11 +8,19 @@
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
"github.com/rackspace/gophercloud/rackspace/lb/v1"
+ "github.com/rackspace/gophercloud/rackspace/lb/v1/acl"
+ "github.com/rackspace/gophercloud/rackspace/lb/v1/monitors"
"github.com/rackspace/gophercloud/rackspace/lb/v1/nodes"
"github.com/rackspace/gophercloud/rackspace/lb/v1/sessions"
+ "github.com/rackspace/gophercloud/rackspace/lb/v1/throttle"
"github.com/rackspace/gophercloud/rackspace/lb/v1/vips"
)
+var (
+ errNameRequired = errors.New("Name is a required attribute")
+ errTimeoutExceeded = errors.New("Timeout must be less than 120")
+)
+
// ListOptsBuilder allows extensions to add additional parameters to the
// List request.
type ListOptsBuilder interface {
@@ -55,17 +63,6 @@
})
}
-type enabledState *bool
-
-// Convenience vars to help setting enabled state.
-var (
- iTrue = true
- iFalse = false
-
- Enabled enabledState = &iTrue
- Disabled enabledState = &iFalse
-)
-
// CreateOptsBuilder is the interface options structs have to satisfy in order
// to be used in the main Create operation in this package. Since many
// extensions decorate or modify the common logic, it is useful for them to
@@ -93,7 +90,7 @@
// Half-Closed support provides the ability for one end of the connection to
// terminate its output, while still receiving data from the other end. Only
// available for TCP/TCP_CLIENT_FIRST protocols.
- HalfClosed enabledState
+ HalfClosed gophercloud.EnabledState
// Optional - the type of virtual IPs you want associated with the load
// balancer.
@@ -101,7 +98,7 @@
// Optional - the access list management feature allows fine-grained network
// access controls to be applied to the load balancer virtual IP address.
- AccessList string
+ AccessList *acl.AccessList
// Optional - algorithm that defines how traffic should be directed between
// back-end nodes.
@@ -112,10 +109,10 @@
// Optional - specifies a limit on the number of connections per IP address
// to help mitigate malicious or abusive traffic to your applications.
- ConnThrottle *ConnectionThrottle
+ ConnThrottle *throttle.ConnectionThrottle
- // Optional -
- //HealthMonitor string
+ // Optional
+ HealthMonitor *monitors.Monitor
// Optional - arbitrary information that can be associated with each LB.
Metadata map[string]interface{}
@@ -138,14 +135,9 @@
// would be redirected to https://example.com/page.html. Only available for
// HTTPS protocol (port=443), or HTTP protocol with a properly configured SSL
// termination (secureTrafficOnly=true, securePort=443).
- HTTPSRedirect enabledState
+ HTTPSRedirect gophercloud.EnabledState
}
-var (
- errNameRequired = errors.New("Name is a required attribute")
- errTimeoutExceeded = errors.New("Timeout must be less than 120")
-)
-
// ToLBCreateMap casts a CreateOpts struct to a map.
func (opts CreateOpts) ToLBCreateMap() (map[string]interface{}, error) {
lb := make(map[string]interface{})
@@ -177,14 +169,12 @@
if opts.HalfClosed != nil {
lb["halfClosed"] = opts.HalfClosed
}
-
if len(opts.VIPs) > 0 {
lb["virtualIps"] = opts.VIPs
}
-
- // if opts.AccessList != "" {
- // lb["accessList"] = opts.AccessList
- // }
+ if opts.AccessList != nil {
+ lb["accessList"] = &opts.AccessList
+ }
if opts.Algorithm != "" {
lb["algorithm"] = opts.Algorithm
}
@@ -194,9 +184,9 @@
if opts.ConnThrottle != nil {
lb["connectionThrottle"] = &opts.ConnThrottle
}
- // if opts.HealthMonitor != "" {
- // lb["healthMonitor"] = opts.HealthMonitor
- // }
+ if opts.HealthMonitor != nil {
+ lb["healthMonitor"] = &opts.HealthMonitor
+ }
if len(opts.Metadata) != 0 {
lb["metadata"] = opts.Metadata
}
@@ -318,7 +308,7 @@
Protocol string
// Optional - see the HalfClosed field in CreateOpts for more information.
- HalfClosed enabledState
+ HalfClosed gophercloud.EnabledState
// Optional - see the Algorithm field in CreateOpts for more information.
Algorithm string
@@ -330,7 +320,7 @@
Timeout int
// Optional - see the HTTPSRedirect field in CreateOpts for more information.
- HTTPSRedirect enabledState
+ HTTPSRedirect gophercloud.EnabledState
}
// ToLBUpdateMap casts an UpdateOpts struct to a map.
diff --git a/rackspace/lb/v1/lbs/requests_test.go b/rackspace/lb/v1/lbs/requests_test.go
index dafbda9..fd50883 100644
--- a/rackspace/lb/v1/lbs/requests_test.go
+++ b/rackspace/lb/v1/lbs/requests_test.go
@@ -3,9 +3,11 @@
import (
"testing"
+ "github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
"github.com/rackspace/gophercloud/rackspace/lb/v1/nodes"
"github.com/rackspace/gophercloud/rackspace/lb/v1/sessions"
+ "github.com/rackspace/gophercloud/rackspace/lb/v1/throttle"
"github.com/rackspace/gophercloud/rackspace/lb/v1/vips"
th "github.com/rackspace/gophercloud/testhelper"
"github.com/rackspace/gophercloud/testhelper/client"
@@ -188,15 +190,10 @@
},
},
SessionPersistence: sessions.SessionPersistence{Type: "HTTP_COOKIE"},
- ConnectionThrottle: ConnectionThrottle{
- MinConns: 10,
- MaxConns: 100,
- MaxConnRate: 50,
- RateInterval: 60,
- },
- Cluster: Cluster{Name: "c1.dfw1"},
- Created: Datetime{Time: "2010-11-30T03:23:42Z"},
- Updated: Datetime{Time: "2010-11-30T03:23:44Z"},
+ ConnectionThrottle: throttle.ConnectionThrottle{MaxConnections: 100},
+ Cluster: Cluster{Name: "c1.dfw1"},
+ Created: Datetime{Time: "2010-11-30T03:23:42Z"},
+ Updated: Datetime{Time: "2010-11-30T03:23:44Z"},
SourceAddrs: SourceAddrs{
IPv4Public: "10.12.99.28",
IPv4Private: "10.0.0.0",
@@ -217,11 +214,11 @@
opts := UpdateOpts{
Name: "a-new-loadbalancer",
Protocol: "TCP",
- HalfClosed: Enabled,
+ HalfClosed: gophercloud.Enabled,
Algorithm: "RANDOM",
Port: 8080,
Timeout: 100,
- HTTPSRedirect: Disabled,
+ HTTPSRedirect: gophercloud.Disabled,
}
err := Update(client.ServiceClient(), id1, opts).ExtractErr()
diff --git a/rackspace/lb/v1/lbs/results.go b/rackspace/lb/v1/lbs/results.go
index 0ad998a..d015d9b 100644
--- a/rackspace/lb/v1/lbs/results.go
+++ b/rackspace/lb/v1/lbs/results.go
@@ -5,8 +5,10 @@
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
+ "github.com/rackspace/gophercloud/rackspace/lb/v1/acl"
"github.com/rackspace/gophercloud/rackspace/lb/v1/nodes"
"github.com/rackspace/gophercloud/rackspace/lb/v1/sessions"
+ "github.com/rackspace/gophercloud/rackspace/lb/v1/throttle"
"github.com/rackspace/gophercloud/rackspace/lb/v1/vips"
)
@@ -124,10 +126,15 @@
// ConnectionThrottle specifies a limit on the number of connections per IP
// address to help mitigate malicious or abusive traffic to your applications.
- ConnectionThrottle ConnectionThrottle
+ ConnectionThrottle throttle.ConnectionThrottle
// TODO
SourceAddrs SourceAddrs `mapstructure:"sourceAddresses"`
+
+ // Represents the access rules for this particular load balancer. IP addresses
+ // or subnet ranges, depending on their type (ALLOW or DENY), can be permitted
+ // or blocked.
+ AccessList acl.AccessList
}
// SourceAddrs - temp
@@ -138,14 +145,6 @@
IPv6Private string `json:"ipv6Servicenet" mapstructure:"ipv6Servicenet"`
}
-// ConnectionThrottle - temp
-type ConnectionThrottle struct {
- MinConns int `json:"minConnections" mapstructure:"minConnections"`
- MaxConns int `json:"maxConnections" mapstructure:"maxConnections"`
- MaxConnRate int `json:"maxConnectionRate" mapstructure:"maxConnectionRate"`
- RateInterval int `json:"rateInterval" mapstructure:"rateInterval"`
-}
-
// ConnectionLogging - temp
type ConnectionLogging struct {
Enabled bool