blob: db93c6f3f4ff549008e5dac06d3ccff8a3281bfe [file] [log] [blame]
Jamie Hannaford1ba046f2014-11-06 13:21:30 +01001package throttle
2
3import (
4 "github.com/mitchellh/mapstructure"
5
6 "github.com/rackspace/gophercloud"
7)
8
9// ConnectionThrottle represents the connection throttle configuration for a
10// particular load balancer.
11type ConnectionThrottle struct {
12 MaxConnections int
13}
14
15// CreateResult represents the result of a create operation.
16type CreateResult struct {
17 gophercloud.ErrResult
18}
19
20// DeleteResult represents the result of a delete operation.
21type DeleteResult struct {
22 gophercloud.ErrResult
23}
24
25// GetResult represents the result of a get operation.
26type GetResult struct {
27 gophercloud.Result
28}
29
30// Extract interprets a GetResult as a SP, if possible.
31func (r GetResult) Extract() (*ConnectionThrottle, error) {
32 if r.Err != nil {
33 return nil, r.Err
34 }
35
36 var response struct {
37 CT ConnectionThrottle `mapstructure:"connectionThrottle"`
38 }
39
40 err := mapstructure.Decode(r.Body, &response)
41
42 return &response.CT, err
43}