Sync baremetal openstack with upstream
Change-Id: I125fc08e2cc4433aeaa470de48823dd4434c2030
Related-PROD: PROD-33018
diff --git a/openstack/baremetal/v1/drivers/requests.go b/openstack/baremetal/v1/drivers/requests.go
index 8e338e4..f50baa6 100644
--- a/openstack/baremetal/v1/drivers/requests.go
+++ b/openstack/baremetal/v1/drivers/requests.go
@@ -5,8 +5,66 @@
"gerrit.mcp.mirantis.net/debian/gophercloud.git/pagination"
)
-func List(c *gophercloud.ServiceClient) pagination.Pager {
- return pagination.NewPager(c, listURL(c), func(r pagination.PageResult) pagination.Page {
- return DriverPage{pagination.SinglePageBase(r)}
+// ListDriversOptsBuilder allows extensions to add additional parameters to the
+// ListDrivers request.
+type ListDriversOptsBuilder interface {
+ ToListDriversOptsQuery() (string, error)
+}
+
+// ListDriversOpts defines query options that can be passed to ListDrivers
+type ListDriversOpts struct {
+ // Provide detailed information about the drivers
+ Detail bool `q:"detail"`
+
+ // Filter the list by the type of the driver
+ Type string `q:"type"`
+}
+
+// ToListDriversOptsQuery formats a ListOpts into a query string
+func (opts ListDriversOpts) ToListDriversOptsQuery() (string, error) {
+ q, err := gophercloud.BuildQueryString(opts)
+ return q.String(), err
+}
+
+// ListDrivers makes a request against the API to list all drivers
+func ListDrivers(client *gophercloud.ServiceClient, opts ListDriversOptsBuilder) pagination.Pager {
+ url := driversURL(client)
+ if opts != nil {
+ query, err := opts.ToListDriversOptsQuery()
+ if err != nil {
+ return pagination.Pager{Err: err}
+ }
+ url += query
+ }
+ return pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page {
+ return DriverPage{pagination.LinkedPageBase{PageResult: r}}
})
}
+
+// GetDriverDetails Shows details for a driver
+func GetDriverDetails(client *gophercloud.ServiceClient, driverName string) (r GetDriverResult) {
+ _, r.Err = client.Get(driverDetailsURL(client, driverName), &r.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
+ })
+ return
+}
+
+// GetDriverProperties Shows the required and optional parameters that
+// driverName expects to be supplied in the driver_info field for every
+// Node it manages
+func GetDriverProperties(client *gophercloud.ServiceClient, driverName string) (r GetPropertiesResult) {
+ _, r.Err = client.Get(driverPropertiesURL(client, driverName), &r.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
+ })
+ return
+}
+
+// GetDriverDiskProperties Show the required and optional parameters that
+// driverName expects to be supplied in the node’s raid_config field, if a
+// RAID configuration change is requested.
+func GetDriverDiskProperties(client *gophercloud.ServiceClient, driverName string) (r GetDiskPropertiesResult) {
+ _, r.Err = client.Get(driverDiskPropertiesURL(client, driverName), &r.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
+ })
+ return
+}