1package api
2
3import "sort"
4
5// Regions is used to query the regions in the cluster.
6type Regions struct {
7	client *Client
8}
9
10// Regions returns a handle on the regions endpoints.
11func (c *Client) Regions() *Regions {
12	return &Regions{client: c}
13}
14
15// List returns a list of all of the regions.
16func (r *Regions) List() ([]string, error) {
17	var resp []string
18	if _, err := r.client.query("/v1/regions", &resp, nil); err != nil {
19		return nil, err
20	}
21	sort.Strings(resp)
22	return resp, nil
23}
24