Jamie Hannaford | 4721abc | 2014-09-16 16:29:04 +0200 | [diff] [blame] | 1 | package apiversions |
| 2 | |
Jamie Hannaford | f0c615b | 2014-09-17 10:56:52 +0200 | [diff] [blame] | 3 | import ( |
Jon Perritt | 27249f4 | 2016-02-18 10:35:59 -0600 | [diff] [blame] | 4 | "github.com/gophercloud/gophercloud" |
| 5 | "github.com/gophercloud/gophercloud/pagination" |
Jamie Hannaford | f0c615b | 2014-09-17 10:56:52 +0200 | [diff] [blame] | 6 | ) |
Jamie Hannaford | 4721abc | 2014-09-16 16:29:04 +0200 | [diff] [blame] | 7 | |
Jamie Hannaford | a311f18 | 2014-09-19 11:19:10 +0200 | [diff] [blame] | 8 | // ListVersions lists all the Neutron API versions available to end-users |
Jamie Hannaford | f0c615b | 2014-09-17 10:56:52 +0200 | [diff] [blame] | 9 | func ListVersions(c *gophercloud.ServiceClient) pagination.Pager { |
Ash Wilson | b8b16f8 | 2014-10-20 10:19:49 -0400 | [diff] [blame] | 10 | return pagination.NewPager(c, apiVersionsURL(c), func(r pagination.PageResult) pagination.Page { |
Jamie Hannaford | f0c615b | 2014-09-17 10:56:52 +0200 | [diff] [blame] | 11 | return APIVersionPage{pagination.SinglePageBase(r)} |
| 12 | }) |
Jamie Hannaford | 4721abc | 2014-09-16 16:29:04 +0200 | [diff] [blame] | 13 | } |
| 14 | |
Jamie Hannaford | a311f18 | 2014-09-19 11:19:10 +0200 | [diff] [blame] | 15 | // ListVersionResources lists all of the different API resources for a particular |
| 16 | // API versions. Typical resources for Neutron might be: networks, subnets, etc. |
Jamie Hannaford | f0c615b | 2014-09-17 10:56:52 +0200 | [diff] [blame] | 17 | func ListVersionResources(c *gophercloud.ServiceClient, v string) pagination.Pager { |
Ash Wilson | b8b16f8 | 2014-10-20 10:19:49 -0400 | [diff] [blame] | 18 | return pagination.NewPager(c, apiInfoURL(c, v), func(r pagination.PageResult) pagination.Page { |
Jamie Hannaford | f0c615b | 2014-09-17 10:56:52 +0200 | [diff] [blame] | 19 | return APIVersionResourcePage{pagination.SinglePageBase(r)} |
| 20 | }) |
Jamie Hannaford | 4721abc | 2014-09-16 16:29:04 +0200 | [diff] [blame] | 21 | } |