func (p AlgorithmPage) IsEmpty() (bool, error) {
	is, err := ExtractAlgorithms(p)
	if err != nil {
		return true, nil
	}
	return len(is) == 0, nil
}
IsEmpty checks whether an AlgorithmPage struct is empty.
package lbs
import (
	"reflect"
	"time"
	"github.com/mitchellh/mapstructure"
	"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"
)
type Protocol struct {
	Name string
	Port int
}
type Algorithm struct {
	Name string
}
type Status string
const (
	ACTIVE Status = "ACTIVE"
	BUILD Status = "BUILD"
	PENDINGUPDATE Status = "PENDING_UPDATE"
	PENDINGDELETE Status = "PENDING_DELETE"
	SUSPENDED Status = "SUSPENDED"
	ERROR Status = "ERROR"
	DELETED Status = "DELETED"
)
type Datetime struct {
	Time time.Time `mapstructure:"-"`
}
type LoadBalancer struct {
	Name string
	ID int
	Protocol string
	Algorithm string
	Status Status
	NodeCount int `mapstructure:"nodeCount"`
	VIPs []vips.VIP `mapstructure:"virtualIps"`
	Created Datetime
	Updated Datetime
	Port int
	HalfClosed bool
	Timeout int
	Cluster Cluster
	Nodes []nodes.Node
	ConnectionLogging ConnectionLogging
	SessionPersistence sessions.SessionPersistence
	ConnectionThrottle throttle.ConnectionThrottle
	SourceAddrs SourceAddrs `mapstructure:"sourceAddresses"`
	AccessList acl.AccessList
}
type SourceAddrs struct {
	IPv4Public  string `json:"ipv4Public" mapstructure:"ipv4Public"`
	IPv4Private string `json:"ipv4Servicenet" mapstructure:"ipv4Servicenet"`
	IPv6Public  string `json:"ipv6Public" mapstructure:"ipv6Public"`
	IPv6Private string `json:"ipv6Servicenet" mapstructure:"ipv6Servicenet"`
}
type ConnectionLogging struct {
	Enabled bool
}
type Cluster struct {
	Name string
}
type LBPage struct {
	pagination.LinkedPageBase
}
func (p LBPage) IsEmpty() (bool, error) {
	is, err := ExtractLBs(p)
	if err != nil {
		return true, nil
	}
	return len(is) == 0, nil
}
func ExtractLBs(page pagination.Page) ([]LoadBalancer, error) {
	var resp struct {
		LBs []LoadBalancer `mapstructure:"loadBalancers" json:"loadBalancers"`
	}
	coll := page.(LBPage).Body
	err := mapstructure.Decode(coll, &resp)
	s := reflect.ValueOf(coll.(map[string]interface{})["loadBalancers"])
	for i := 0; i < s.Len(); i++ {
		val := (s.Index(i).Interface()).(map[string]interface{})
		ts, err := extractTS(val, "created")
		if err != nil {
			return resp.LBs, err
		}
		resp.LBs[i].Created.Time = ts
		ts, err = extractTS(val, "updated")
		if err != nil {
			return resp.LBs, err
		}
		resp.LBs[i].Updated.Time = ts
	}
	return resp.LBs, err
}
func extractTS(body map[string]interface{}, key string) (time.Time, error) {
	val := body[key].(map[string]interface{})
	return time.Parse(time.RFC3339, val["time"].(string))
}
type commonResult struct {
	gophercloud.Result
}
func (r commonResult) Extract() (*LoadBalancer, error) {
	if r.Err != nil {
		return nil, r.Err
	}
	var response struct {
		LB LoadBalancer `mapstructure:"loadBalancer"`
	}
	err := mapstructure.Decode(r.Body, &response)
	json := r.Body.(map[string]interface{})
	lb := json["loadBalancer"].(map[string]interface{})
	ts, err := extractTS(lb, "created")
	if err != nil {
		return nil, err
	}
	response.LB.Created.Time = ts
	ts, err = extractTS(lb, "updated")
	if err != nil {
		return nil, err
	}
	response.LB.Updated.Time = ts
	return &response.LB, err
}
type CreateResult struct {
	commonResult
}
type DeleteResult struct {
	gophercloud.ErrResult
}
type UpdateResult struct {
	gophercloud.ErrResult
}
type GetResult struct {
	commonResult
}
type ProtocolPage struct {
	pagination.SinglePageBase
}
func (p ProtocolPage) IsEmpty() (bool, error) {
	is, err := ExtractProtocols(p)
	if err != nil {
		return true, nil
	}
	return len(is) == 0, nil
}
func ExtractProtocols(page pagination.Page) ([]Protocol, error) {
	var resp struct {
		Protocols []Protocol `mapstructure:"protocols" json:"protocols"`
	}
	err := mapstructure.Decode(page.(ProtocolPage).Body, &resp)
	return resp.Protocols, err
}
type AlgorithmPage struct {
	pagination.SinglePageBase
}