blob: aff397b9f554aa43c492cc28e1324cc902e9a248 [file] [log] [blame]
Jamie Hannaford82523522015-02-17 16:53:29 +01001package datastores
2
3import (
Jon Perritt27249f42016-02-18 10:35:59 -06004 "github.com/gophercloud/gophercloud"
5 "github.com/gophercloud/gophercloud/pagination"
Jamie Hannaford82523522015-02-17 16:53:29 +01006)
7
Jamie Hannafordb0d267b2015-02-19 11:59:53 +01008// List will list all available datastore types that instances can use.
Jamie Hannaford82523522015-02-17 16:53:29 +01009func List(client *gophercloud.ServiceClient) pagination.Pager {
Jon Perrittdb0ae142016-03-13 00:33:41 -060010 return pagination.NewPager(client, baseURL(client), func(r pagination.PageResult) pagination.Page {
Jamie Hannaford82523522015-02-17 16:53:29 +010011 return DatastorePage{pagination.SinglePageBase(r)}
Jon Perrittdb0ae142016-03-13 00:33:41 -060012 })
Jamie Hannaford82523522015-02-17 16:53:29 +010013}
14
Jamie Hannafordb0d267b2015-02-19 11:59:53 +010015// Get will retrieve the details of a specified datastore type.
Jon Perritt3860b512016-03-29 12:01:48 -050016func Get(client *gophercloud.ServiceClient, datastoreID string) (r GetResult) {
Jon Perrittdb0ae142016-03-13 00:33:41 -060017 _, r.Err = client.Get(resourceURL(client, datastoreID), &r.Body, nil)
Jamie Hannaford82523522015-02-17 16:53:29 +010018}
19
Jamie Hannafordb0d267b2015-02-19 11:59:53 +010020// ListVersions will list all of the available versions for a specified
21// datastore type.
Jamie Hannaford82523522015-02-17 16:53:29 +010022func ListVersions(client *gophercloud.ServiceClient, datastoreID string) pagination.Pager {
Jon Perrittdb0ae142016-03-13 00:33:41 -060023 return pagination.NewPager(client, versionsURL(client, datastoreID), func(r pagination.PageResult) pagination.Page {
Jamie Hannaford82523522015-02-17 16:53:29 +010024 return VersionPage{pagination.SinglePageBase(r)}
Jon Perrittdb0ae142016-03-13 00:33:41 -060025 })
Jamie Hannaford82523522015-02-17 16:53:29 +010026}
27
Jamie Hannafordb0d267b2015-02-19 11:59:53 +010028// GetVersion will retrieve the details of a specified datastore version.
Jon Perritt3860b512016-03-29 12:01:48 -050029func GetVersion(client *gophercloud.ServiceClient, datastoreID, versionID string) (r GetVersionResult) {
Jon Perrittdb0ae142016-03-13 00:33:41 -060030 _, r.Err = client.Get(versionURL(client, datastoreID, versionID), &r.Body, nil)
Jamie Hannaford82523522015-02-17 16:53:29 +010031}