-
Notifications
You must be signed in to change notification settings - Fork 1
/
zone.go
58 lines (48 loc) · 1.42 KB
/
zone.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Proof of Concepts for the Cloud-Barista Multi-Cloud Project.
// * Cloud-Barista: https://github.com/cloud-barista
//
// KT Cloud SDK go
//
// by ETRI, 2021.07.
package ktcloudsdk
import (
"net/url"
)
func (c KtCloudClient) ListZones(isAvailable bool, domainId string, zoneId string, keyword string) (ListZonesResponse, error) {
var resp ListZonesResponse
params := url.Values{}
if isAvailable {
params.Set("available", "true")
}
if domainId != "" {
params.Set("domainid", domainId)
}
if zoneId != "" {
params.Set("id", zoneId)
}
if keyword != "" {
params.Set("keyword", keyword)
}
response, err := NewRequest(c, "listZones", params)
if err != nil {
return resp, err
}
resp = response.(ListZonesResponse)
return resp, err
}
type Zone struct {
ID string `json:"id"`
NetworkType string `json:"networktype"`
SecurityGroupsEnabled bool `json:"securitygroupsenabled"`
AllocationState string `json:"allocationstate"`
DhcpProvider string `json:"dhcpprovider"`
LocalStorageEnabled bool `json:"localstorageenabled"`
Tags []interface{} `json:"tags"`
Name string `json:"name"`
}
type ListZonesResponse struct {
Listzonesresponse struct {
Count int `json:"count"`
Zone []Zone `json:"zone"`
} `json:"listZonesResponse"`
}