1package egoscale
2
3import (
4	"net"
5)
6
7// Zone represents a data center
8type Zone struct {
9	AllocationState       string            `json:"allocationstate,omitempty" doc:"the allocation state of the cluster"`
10	Description           string            `json:"description,omitempty" doc:"Zone description"`
11	DhcpProvider          string            `json:"dhcpprovider,omitempty" doc:"the dhcp Provider for the Zone"`
12	DisplayText           string            `json:"displaytext,omitempty" doc:"the display text of the zone"`
13	DNS1                  net.IP            `json:"dns1,omitempty" doc:"the first DNS for the Zone"`
14	DNS2                  net.IP            `json:"dns2,omitempty" doc:"the second DNS for the Zone"`
15	GuestCIDRAddress      *CIDR             `json:"guestcidraddress,omitempty" doc:"the guest CIDR address for the Zone"`
16	ID                    *UUID             `json:"id,omitempty" doc:"Zone id"`
17	InternalDNS1          net.IP            `json:"internaldns1,omitempty" doc:"the first internal DNS for the Zone"`
18	InternalDNS2          net.IP            `json:"internaldns2,omitempty" doc:"the second internal DNS for the Zone"`
19	IP6DNS1               net.IP            `json:"ip6dns1,omitempty" doc:"the first IPv6 DNS for the Zone"`
20	IP6DNS2               net.IP            `json:"ip6dns2,omitempty" doc:"the second IPv6 DNS for the Zone"`
21	LocalStorageEnabled   *bool             `json:"localstorageenabled,omitempty" doc:"true if local storage offering enabled, false otherwise"`
22	Name                  string            `json:"name,omitempty" doc:"Zone name"`
23	NetworkType           string            `json:"networktype,omitempty" doc:"the network type of the zone; can be Basic or Advanced"`
24	ResourceDetails       map[string]string `json:"resourcedetails,omitempty" doc:"Meta data associated with the zone (key/value pairs)"`
25	SecurityGroupsEnabled *bool             `json:"securitygroupsenabled,omitempty" doc:"true if security groups support is enabled, false otherwise"`
26	Tags                  []ResourceTag     `json:"tags,omitempty" doc:"the list of resource tags associated with zone."`
27	Vlan                  string            `json:"vlan,omitempty" doc:"the vlan range of the zone"`
28	ZoneToken             string            `json:"zonetoken,omitempty" doc:"Zone Token"`
29}
30
31// ListRequest builds the ListZones request
32func (zone Zone) ListRequest() (ListCommand, error) {
33	req := &ListZones{
34		ID:   zone.ID,
35		Name: zone.Name,
36	}
37
38	return req, nil
39}
40
41//go:generate go run generate/main.go -interface=Listable ListZones
42
43// ListZones represents a query for zones
44type ListZones struct {
45	Available      *bool         `json:"available,omitempty" doc:"true if you want to retrieve all available Zones. False if you only want to return the Zones from which you have at least one VM. Default is false."`
46	ID             *UUID         `json:"id,omitempty" doc:"the ID of the zone"`
47	Keyword        string        `json:"keyword,omitempty" doc:"List by keyword"`
48	Name           string        `json:"name,omitempty" doc:"the name of the zone"`
49	Page           int           `json:"page,omitempty"`
50	PageSize       int           `json:"pagesize,omitempty"`
51	ShowCapacities *bool         `json:"showcapacities,omitempty" doc:"flag to display the capacity of the zones"`
52	Tags           []ResourceTag `json:"tags,omitempty" doc:"List zones by resource tags (key/value pairs)"`
53	_              bool          `name:"listZones" description:"Lists zones"`
54}
55
56// ListZonesResponse represents a list of zones
57type ListZonesResponse struct {
58	Count int    `json:"count"`
59	Zone  []Zone `json:"zone"`
60}
61