-
Notifications
You must be signed in to change notification settings - Fork 9
/
cloud.go
37 lines (32 loc) · 922 Bytes
/
cloud.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
29
30
31
32
33
34
35
36
37
package cloud66
type Cloud struct {
Id string `json:"name"`
Name string `json:"display_name"`
KeyName string `json:"key_name"`
Regions []CloudRegion `json:"regions"`
ServerSizes []CloudServerSize `json:"server_sizes"`
}
type CloudServerSize struct {
Id string `json:"id"`
Name string `json:"name"`
}
type CloudRegion struct {
Id string `json:"id"`
Name string `json:"name"`
}
func (c *Client) GetCloudsInfo() ([]Cloud, error) {
req, err := c.NewRequest("GET", "/clouds.json", nil, nil)
if err != nil {
return nil, err
}
var cloudRes []Cloud
return cloudRes, c.DoReq(req, &cloudRes, nil)
}
func (c *Client) GetCloudInfo(cloudName string) (*Cloud, error) {
req, err := c.NewRequest("GET", "/clouds/"+cloudName+".json", nil, nil)
if err != nil {
return nil, err
}
var cloudRes *Cloud
return cloudRes, c.DoReq(req, &cloudRes, nil)
}