Jon Perritt | 85ed523 | 2015-01-16 09:14:51 -0700 | [diff] [blame] | 1 | package base |
| 2 | |
Ash Wilson | f98df8d | 2015-02-12 15:46:40 -0500 | [diff] [blame^] | 3 | import "github.com/rackspace/gophercloud" |
Jon Perritt | 85ed523 | 2015-01-16 09:14:51 -0700 | [diff] [blame] | 4 | |
| 5 | // Get retrieves the home document, allowing the user to discover the |
| 6 | // entire API. |
| 7 | func Get(c *gophercloud.ServiceClient) GetResult { |
| 8 | var res GetResult |
Ash Wilson | f98df8d | 2015-02-12 15:46:40 -0500 | [diff] [blame^] | 9 | _, res.Err = c.Request("GET", getURL(c), gophercloud.RequestOpts{ |
| 10 | JSONResponse: &res.Body, |
| 11 | OkCodes: []int{200}, |
Jon Perritt | 85ed523 | 2015-01-16 09:14:51 -0700 | [diff] [blame] | 12 | }) |
| 13 | return res |
| 14 | } |
| 15 | |
| 16 | // Ping retrieves a ping to the server. |
| 17 | func Ping(c *gophercloud.ServiceClient) PingResult { |
| 18 | var res PingResult |
Ash Wilson | f98df8d | 2015-02-12 15:46:40 -0500 | [diff] [blame^] | 19 | _, res.Err = c.Request("GET", pingURL(c), gophercloud.RequestOpts{ |
Jon Perritt | 85ed523 | 2015-01-16 09:14:51 -0700 | [diff] [blame] | 20 | OkCodes: []int{204}, |
Ash Wilson | f98df8d | 2015-02-12 15:46:40 -0500 | [diff] [blame^] | 21 | MoreHeaders: map[string]string{"Accept": ""}, |
Jon Perritt | 85ed523 | 2015-01-16 09:14:51 -0700 | [diff] [blame] | 22 | }) |
| 23 | return res |
| 24 | } |