Adding fixes based on code review
diff --git a/rackspace/lb/v1/lbs/requests.go b/rackspace/lb/v1/lbs/requests.go
index eae54d1..342f107 100644
--- a/rackspace/lb/v1/lbs/requests.go
+++ b/rackspace/lb/v1/lbs/requests.go
@@ -514,7 +514,7 @@
// on the load balancer for easy retrieval by web clients. Content caching
// improves the performance of high traffic web sites by temporarily storing
// data that was recently accessed. While it's cached, requests for that data
-// are served by the load balancer, which in turn reduces load off the back end
+// are served by the load balancer, which in turn reduces load off the back-end
// nodes. The result is improved response times for those requests and less
// load on the web server.
func IsContentCached(client *gophercloud.ServiceClient, id int) (bool, error) {
diff --git a/rackspace/lb/v1/lbs/results.go b/rackspace/lb/v1/lbs/results.go
index 88ed062..338de80 100644
--- a/rackspace/lb/v1/lbs/results.go
+++ b/rackspace/lb/v1/lbs/results.go
@@ -33,31 +33,31 @@
const (
// ACTIVE indicates that the LB is configured properly and ready to serve
// traffic to incoming requests via the configured virtual IPs.
- ACTIVE = "ACTIVE"
+ ACTIVE Status = "ACTIVE"
// BUILD indicates that the LB is being provisioned for the first time and
// configuration is being applied to bring the service online. The service
// cannot yet serve incoming requests.
- BUILD = "BUILD"
+ BUILD Status = "BUILD"
// PENDINGUPDATE indicates that the LB is online but configuration changes
// are being applied to update the service based on a previous request.
- PENDINGUPDATE = "PENDING_UPDATE"
+ PENDINGUPDATE Status = "PENDING_UPDATE"
// PENDINGDELETE indicates that the LB is online but configuration changes
// are being applied to begin deletion of the service based on a previous
// request.
- PENDINGDELETE = "PENDING_DELETE"
+ PENDINGDELETE Status = "PENDING_DELETE"
// SUSPENDED indicates that the LB has been taken offline and disabled.
- SUSPENDED = "SUSPENDED"
+ SUSPENDED Status = "SUSPENDED"
// ERROR indicates that the system encountered an error when attempting to
// configure the load balancer.
- ERROR = "ERROR"
+ ERROR Status = "ERROR"
// DELETED indicates that the LB has been deleted.
- DELETED = "DELETED"
+ DELETED Status = "DELETED"
)
// Datetime represents the structure of a Created or Updated field.
@@ -110,14 +110,14 @@
// nodes. Defaults to 30 seconds with a maximum of 120 seconds.
Timeout int
- // TODO
+ // The cluster name.
Cluster Cluster
// Nodes shows all the back-end nodes which are associated with the load
// balancer. These are the devices which are delivered traffic.
Nodes []nodes.Node
- // TODO
+ // Current connection logging configuration.
ConnectionLogging ConnectionLogging
// SessionPersistence specifies whether multiple requests from clients are
@@ -128,7 +128,7 @@
// address to help mitigate malicious or abusive traffic to your applications.
ConnectionThrottle throttle.ConnectionThrottle
- // TODO
+ // The source public and private IP addresses.
SourceAddrs SourceAddrs `mapstructure:"sourceAddresses"`
// Represents the access rules for this particular load balancer. IP addresses
@@ -137,7 +137,7 @@
AccessList acl.AccessList
}
-// SourceAddrs - temp
+// SourceAddrs represents the source public and private IP addresses.
type SourceAddrs struct {
IPv4Public string `json:"ipv4Public" mapstructure:"ipv4Public"`
IPv4Private string `json:"ipv4Servicenet" mapstructure:"ipv4Servicenet"`
@@ -238,7 +238,7 @@
}
// ExtractProtocols accepts a Page struct, specifically a ProtocolPage struct,
-// and extracts the elements into a slice of LoadBalancer structs. In other
+// and extracts the elements into a slice of Protocol structs. In other
// words, a generic collection is mapped into a relevant slice.
func ExtractProtocols(page pagination.Page) ([]Protocol, error) {
var resp struct {
@@ -254,7 +254,7 @@
pagination.SinglePageBase
}
-// IsEmpty checks whether a ProtocolPage struct is empty.
+// IsEmpty checks whether an AlgorithmPage struct is empty.
func (p AlgorithmPage) IsEmpty() (bool, error) {
is, err := ExtractAlgorithms(p)
if err != nil {
@@ -362,6 +362,7 @@
SSLCurrentConnections int `mapstructure:"currentConnSsl"`
}
+// StatsResult represents the result of a Stats operation.
type StatsResult struct {
gophercloud.Result
}
diff --git a/rackspace/lb/v1/monitors/doc.go b/rackspace/lb/v1/monitors/doc.go
index 624a17d..2c5be75 100644
--- a/rackspace/lb/v1/monitors/doc.go
+++ b/rackspace/lb/v1/monitors/doc.go
@@ -1,6 +1,6 @@
/*
-Package lbs provides information and interaction with the Health Monitor API
-resource for the Rackspace Cloud Load Balancer service.
+Package monitors provides information and interaction with the Health Monitor
+API resource for the Rackspace Cloud Load Balancer service.
The load balancing service includes a health monitoring resource that
periodically checks your back-end nodes to ensure they are responding correctly.
diff --git a/rackspace/lb/v1/monitors/results.go b/rackspace/lb/v1/monitors/results.go
index e4c6f4d..eec556f 100644
--- a/rackspace/lb/v1/monitors/results.go
+++ b/rackspace/lb/v1/monitors/results.go
@@ -22,10 +22,10 @@
// A CONNECT monitor establishes a basic connection to each node on its defined
// port to ensure that the service is listening properly. The connect monitor
// is the most basic type of health check and does no post-processing or
-// protocol specific health checks.
+// protocol-specific health checks.
//
// HTTP and HTTPS health monitors are generally considered more intelligent and
-// powerful than CONNECT. It is capable of processing a HTTP or HTTPS response
+// powerful than CONNECT. It is capable of processing an HTTP or HTTPS response
// to determine the condition of a node. It supports the same basic properties
// as CONNECT and includes additional attributes that are used to evaluate the
// HTTP response.
diff --git a/rackspace/lb/v1/nodes/results.go b/rackspace/lb/v1/nodes/results.go
index 759293a..916485f 100644
--- a/rackspace/lb/v1/nodes/results.go
+++ b/rackspace/lb/v1/nodes/results.go
@@ -70,7 +70,7 @@
// Status indicates whether the node can accept service traffic. If a node is
// not listening on its port or does not meet the conditions of the defined
// active health check for the load balancer, then the load balancer does not
-// forward connections and its status is listed as OFFLINE
+// forward connections, and its status is listed as OFFLINE.
type Status string
const (
diff --git a/rackspace/lb/v1/sessions/results.go b/rackspace/lb/v1/sessions/results.go
index 181e0d9..fe90e72 100644
--- a/rackspace/lb/v1/sessions/results.go
+++ b/rackspace/lb/v1/sessions/results.go
@@ -42,7 +42,7 @@
gophercloud.Result
}
-// Extract interprets a GetResult as a SP, if possible.
+// Extract interprets a GetResult as an SP, if possible.
func (r GetResult) Extract() (*SessionPersistence, error) {
if r.Err != nil {
return nil, r.Err
diff --git a/rackspace/lb/v1/ssl/doc.go b/rackspace/lb/v1/ssl/doc.go
index ab93c18..6a2c174 100644
--- a/rackspace/lb/v1/ssl/doc.go
+++ b/rackspace/lb/v1/ssl/doc.go
@@ -17,6 +17,6 @@
to the CA root.
If used for HTTP to HTTPS redirection, the LoadBalancer's securePort attribute
-must be set to 443 and its secureTrafficOnly attribute must be true.
+must be set to 443, and its secureTrafficOnly attribute must be true.
*/
package ssl
diff --git a/rackspace/lb/v1/ssl/requests.go b/rackspace/lb/v1/ssl/requests.go
index e1fbbbd..84b2712 100644
--- a/rackspace/lb/v1/ssl/requests.go
+++ b/rackspace/lb/v1/ssl/requests.go
@@ -24,22 +24,22 @@
// UpdateOpts is the common options struct used in this package's Update
// operation.
type UpdateOpts struct {
- // Required
+ // Required - consult the SSLTermConfig struct for more info.
SecurePort int
- // Required
+ // Required - consult the SSLTermConfig struct for more info.
PrivateKey string
- // Required
+ // Required - consult the SSLTermConfig struct for more info.
Certificate string
- // Required
+ // Required - consult the SSLTermConfig struct for more info.
IntCertificate string
- // Optional
+ // Optional - consult the SSLTermConfig struct for more info.
Enabled *bool
- // Optional
+ // Optional - consult the SSLTermConfig struct for more info.
SecureTrafficOnly *bool
}
@@ -133,22 +133,22 @@
})
}
-// AddCertOptsBuilder is the interface options structs have to satisfy in order
-// to be used in the AddCert operation in this package.
-type AddCertOptsBuilder interface {
- ToCertAddMap() (map[string]interface{}, error)
+// CreateCertOptsBuilder is the interface options structs have to satisfy in
+// order to be used in the AddCert operation in this package.
+type CreateCertOptsBuilder interface {
+ ToCertCreateMap() (map[string]interface{}, error)
}
-// AddCertOpts represents the options used when adding a new certificate mapping.
-type AddCertOpts struct {
+// CreateCertOpts represents the options used when adding a new certificate mapping.
+type CreateCertOpts struct {
HostName string
PrivateKey string
Certificate string
IntCertificate string
}
-// ToCertAddMap will cast an AddCertOpts struct to a map for JSON serialization.
-func (opts AddCertOpts) ToCertAddMap() (map[string]interface{}, error) {
+// ToCertCreateMap will cast an CreateCertOpts struct to a map for JSON serialization.
+func (opts CreateCertOpts) ToCertCreateMap() (map[string]interface{}, error) {
cm := make(map[string]interface{})
if opts.HostName == "" {
@@ -172,14 +172,14 @@
return map[string]interface{}{"certificateMapping": cm}, nil
}
-// AddCert will add a new SSL certificate and allow an SSL-terminated HTTP
+// CreateCert will add a new SSL certificate and allow an SSL-terminated HTTP
// load balancer to use it. This feature is useful because it allows multiple
// certificates to be used. The maximum number of certificates that can be
// stored per LB is 20.
-func AddCert(c *gophercloud.ServiceClient, lbID int, opts AddCertOptsBuilder) AddCertResult {
- var res AddCertResult
+func CreateCert(c *gophercloud.ServiceClient, lbID int, opts CreateCertOptsBuilder) CreateCertResult {
+ var res CreateCertResult
- reqBody, err := opts.ToCertAddMap()
+ reqBody, err := opts.ToCertCreateMap()
if err != nil {
res.Err = err
return res
diff --git a/rackspace/lb/v1/ssl/requests_test.go b/rackspace/lb/v1/ssl/requests_test.go
index 2de88cd..fb14c4a 100644
--- a/rackspace/lb/v1/ssl/requests_test.go
+++ b/rackspace/lb/v1/ssl/requests_test.go
@@ -88,20 +88,20 @@
th.AssertEquals(t, 1, count)
}
-func TestAddCert(t *testing.T) {
+func TestCreateCert(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
mockAddCertResponse(t, lbID)
- opts := AddCertOpts{
+ opts := CreateCertOpts{
HostName: "rackspace.com",
PrivateKey: "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAwIudSMpRZx7TS0/AtDVX3DgXwLD9g+XrNaoazlhwhpYALgzJ\nLAbAnOxT6OT0gTpkPus/B7QhW6y6Auf2cdBeW31XoIwPsSoyNhxgErGBxzNARRB9\nlI1HCa1ojFrcULluj4W6rpaOycI5soDBJiJHin/hbZBPZq6vhPCuNP7Ya48Zd/2X\nCQ9ft3XKfmbs1SdrdROIhigse/SGRbMrCorn/vhNIuohr7yOlHG3GcVcUI9k6ZSZ\nBbqF+ZA4ApSF/Q6/cumieEgofhkYbx5fg02s9Jwr4IWnIR2bSHs7UQ6sVgKYzjs7\nPd3Unpa74jFw6/H6shABoO2CIYLotGmQbFgnpwIDAQABAoIBAQCBCQ+PCIclJHNV\ntUzfeCA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BgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVUzCCASIw\nDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANNh55lwTVwQvNoEZjq1zGdYz9jA\nXXdjizn8AJhjHLOAallfPtvCfTEgKanhdoyz5FnhQE8HbDAop/KNS1lN2UMvdl5f\nZNLTSjJrNtedqxQwxN/i3bpyBxNVejUH2NjV1mmyj+5CJYwCzWalvI/gLPq/A3as\nO2EQqtf3U8unRgn0zXLRdYxV9MrUzNAmdipPNvNrsVdrCgA42rgF/8KsyRVQfJCX\nfN7PGCfrsC3YaUvhymraWxNnXIzMYTNa9wEeBZLUw8SlEtpa1Zsvui+TPXu3USNZ\nVnWH8Lb6ENlnoX0VBwo62fjOG3JzhNKoJawi3bRqyDdINOvafr7iPrrs/T8CAwEA\nAaMyMDAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUNpx1Pc6cGA7KqEwHMmHB\nTZMA7lQwDQYJKoZIhvcNAQEFBQADggEBAMoRgH3iTG3t317viLKoY+lNMHUgHuR7\nb3mn9MidJKyYVewe6hCDIN6WY4fUojmMW9wFJWJIo0hRMNHL3n3tq8HP2j20Mxy8\nacPdfGZJa+jiBw72CrIGdobKaFduIlIEDBA1pNdZIJ+EulrtqrMesnIt92WaypIS\n8JycbIgDMCiyC0ENHEk8UWlC6429c7OZAsplMTbHME/1R4btxjkdfrYZJjdJ2yL2\n8cjZDUDMCPTdW/ycP07Gkq30RB5tACB5aZdaCn2YaKC8FsEdhff4X7xEOfOEHWEq\nSRxADDj8Lx1MT6QpR07hCiDyHfTCtbqzI0iGjX63Oh7xXSa0f+JVTa8=\n-----END CERTIFICATE-----\n",
}
- cm, err := AddCert(client.ServiceClient(), lbID, opts).Extract()
+ cm, err := CreateCert(client.ServiceClient(), lbID, opts).Extract()
th.AssertNoErr(t, err)
expected := &Certificate{
diff --git a/rackspace/lb/v1/ssl/results.go b/rackspace/lb/v1/ssl/results.go
index 283f774..ead9fcd 100644
--- a/rackspace/lb/v1/ssl/results.go
+++ b/rackspace/lb/v1/ssl/results.go
@@ -132,8 +132,8 @@
return &response.Cert, err
}
-// AddCertResult represents the result of an AddCert operation.
-type AddCertResult struct {
+// CreateCertResult represents the result of an CreateCert operation.
+type CreateCertResult struct {
certResult
}
diff --git a/rackspace/lb/v1/vips/doc.go b/rackspace/lb/v1/vips/doc.go
index 861cbef..5c3846d 100644
--- a/rackspace/lb/v1/vips/doc.go
+++ b/rackspace/lb/v1/vips/doc.go
@@ -1,5 +1,5 @@
/*
-Package nodes provides information and interaction with the Virtual IP API
+Package vips provides information and interaction with the Virtual IP API
resource for the Rackspace Cloud Load Balancer service.
A virtual IP (VIP) makes a load balancer accessible by clients. The load