-
Notifications
You must be signed in to change notification settings - Fork 0
/
size.go
28 lines (25 loc) · 807 Bytes
/
size.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package dogo
// Size is a representation for the size of a DigitalOcean droplet.
type Size struct {
Slug string `json:"slug,omitempty"`
Memory int `json:"memory,omitempty"`
VCPUS int `json:"vcpus,omitempty"`
Disk int `json:"disk,omitempty"`
Transfer int `json:"transfer,omitempty"`
PriceMonthly float32 `json:"price_monthly,omitempty"`
PriceHourly float32 `json:"price_hourly,omitempty"`
Regions []string `json:"regions,omitempty"`
}
// Sizes is a list of Size.
type Sizes []*Size
// ListSizes returns all currently available droplet sizes.
func (c *Client) ListSizes() (Sizes, error) {
s := struct {
Sizes `json:"sizes,omitempty"`
}{}
err := c.get(SizeEndpoint, &s)
if err != nil {
return nil, err
}
return s.Sizes, nil
}