Jon Perritt | 85ed523 | 2015-01-16 09:14:51 -0700 | [diff] [blame] | 1 | package base |
| 2 | |
Jon Perritt | 27249f4 | 2016-02-18 10:35:59 -0600 | [diff] [blame] | 3 | import "github.com/gophercloud/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 { |
Jon Perritt | db0ae14 | 2016-03-13 00:33:41 -0600 | [diff] [blame] | 8 | var r GetResult |
| 9 | _, r.Err = c.Get(getURL(c), &r.Body, nil) |
| 10 | return r |
Jon Perritt | 85ed523 | 2015-01-16 09:14:51 -0700 | [diff] [blame] | 11 | } |
| 12 | |
| 13 | // Ping retrieves a ping to the server. |
| 14 | func Ping(c *gophercloud.ServiceClient) PingResult { |
Jon Perritt | db0ae14 | 2016-03-13 00:33:41 -0600 | [diff] [blame] | 15 | var r PingResult |
| 16 | _, r.Err = c.Get(pingURL(c), nil, &gophercloud.RequestOpts{ |
Jon Perritt | 85ed523 | 2015-01-16 09:14:51 -0700 | [diff] [blame] | 17 | OkCodes: []int{204}, |
Ash Wilson | f98df8d | 2015-02-12 15:46:40 -0500 | [diff] [blame] | 18 | MoreHeaders: map[string]string{"Accept": ""}, |
Jon Perritt | 85ed523 | 2015-01-16 09:14:51 -0700 | [diff] [blame] | 19 | }) |
Jon Perritt | db0ae14 | 2016-03-13 00:33:41 -0600 | [diff] [blame] | 20 | return r |
Jon Perritt | 85ed523 | 2015-01-16 09:14:51 -0700 | [diff] [blame] | 21 | } |