1package status
2
3import (
4	"github.com/gophercloud/gophercloud"
5)
6
7// GetOptsBuilder allows to add additional parameters to the Get request.
8type GetOptsBuilder interface {
9	ToStatusGetQuery() (string, error)
10}
11
12// GetOpts allows to provide additional options to the Gnocchi status Get request.
13type GetOpts struct {
14	// Details allows to get status with all attributes.
15	Details *bool `q:"details"`
16}
17
18// ToStatusGetQuery formats a GetOpts into a query string.
19func (opts GetOpts) ToStatusGetQuery() (string, error) {
20	q, err := gophercloud.BuildQueryString(opts)
21	return q.String(), err
22}
23
24// Get retrieves the overall status of the Gnocchi installation.
25func Get(c *gophercloud.ServiceClient, opts GetOptsBuilder) (r GetResult) {
26	url := getURL(c)
27	if opts != nil {
28		query, err := opts.ToStatusGetQuery()
29		if err != nil {
30			r.Err = err
31			return
32		}
33		url += query
34	}
35	_, r.Err = c.Get(url, &r.Body, nil)
36	return
37}
38