-
Notifications
You must be signed in to change notification settings - Fork 14
/
instance_pool.go
170 lines (150 loc) · 6.88 KB
/
instance_pool.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
package egoscale
// InstancePoolState represents the state of an Instance Pool.
type InstancePoolState string
const (
// InstancePoolCreating creating state.
InstancePoolCreating InstancePoolState = "creating"
// InstancePoolRunning running state.
InstancePoolRunning InstancePoolState = "running"
// InstancePoolDestroying destroying state.
InstancePoolDestroying InstancePoolState = "destroying"
// InstancePoolScalingUp scaling up state.
InstancePoolScalingUp InstancePoolState = "scaling-up"
// InstancePoolScalingDown scaling down state.
InstancePoolScalingDown InstancePoolState = "scaling-down"
)
// InstancePool represents an Instance Pool.
type InstancePool struct {
ID *UUID `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
ServiceOfferingID *UUID `json:"serviceofferingid"`
TemplateID *UUID `json:"templateid"`
ZoneID *UUID `json:"zoneid"`
AntiAffinityGroupIDs []UUID `json:"affinitygroupids"`
SecurityGroupIDs []UUID `json:"securitygroupids"`
NetworkIDs []UUID `json:"networkids"`
IPv6 bool `json:"ipv6"`
KeyPair string `json:"keypair"`
UserData string `json:"userdata"`
Size int `json:"size"`
RootDiskSize int `json:"rootdisksize"`
State InstancePoolState `json:"state"`
VirtualMachines []VirtualMachine `json:"virtualmachines"`
}
// CreateInstancePool represents an Instance Pool creation API request.
type CreateInstancePool struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
ServiceOfferingID *UUID `json:"serviceofferingid"`
TemplateID *UUID `json:"templateid"`
ZoneID *UUID `json:"zoneid"`
AntiAffinityGroupIDs []UUID `json:"affinitygroupids,omitempty"`
SecurityGroupIDs []UUID `json:"securitygroupids,omitempty"`
NetworkIDs []UUID `json:"networkids,omitempty"`
IPv6 bool `json:"ipv6,omitempty"`
KeyPair string `json:"keypair,omitempty"`
UserData string `json:"userdata,omitempty"`
Size int `json:"size"`
RootDiskSize int `json:"rootdisksize,omitempty"`
_ bool `name:"createInstancePool" description:"Create an Instance Pool"`
}
// CreateInstancePoolResponse represents an Instance Pool creation API response.
type CreateInstancePoolResponse struct {
ID *UUID `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
ServiceOfferingID *UUID `json:"serviceofferingid"`
TemplateID *UUID `json:"templateid"`
ZoneID *UUID `json:"zoneid"`
AntiAffinityGroupIDs []UUID `json:"affinitygroupids"`
SecurityGroupIDs []UUID `json:"securitygroupids"`
NetworkIDs []UUID `json:"networkids"`
IPv6 bool `json:"ipv6"`
KeyPair string `json:"keypair"`
UserData string `json:"userdata"`
Size int64 `json:"size"`
RootDiskSize int `json:"rootdisksize"`
State InstancePoolState `json:"state"`
}
// Response returns an empty structure to unmarshal an Instance Pool creation API response into.
func (CreateInstancePool) Response() interface{} {
return new(CreateInstancePoolResponse)
}
// UpdateInstancePool represents an Instance Pool update API request.
type UpdateInstancePool struct {
ID *UUID `json:"id"`
ZoneID *UUID `json:"zoneid"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
TemplateID *UUID `json:"templateid,omitempty"`
RootDiskSize int `json:"rootdisksize,omitempty"`
UserData string `json:"userdata,omitempty"`
IPv6 bool `json:"ipv6,omitempty"`
_ bool `name:"updateInstancePool" description:"Update an Instance Pool"`
}
// Response returns an empty structure to unmarshal an Instance Pool update API response into.
func (UpdateInstancePool) Response() interface{} {
return new(BooleanResponse)
}
// ScaleInstancePool represents an Instance Pool scaling API request.
type ScaleInstancePool struct {
ID *UUID `json:"id"`
ZoneID *UUID `json:"zoneid"`
Size int `json:"size"`
_ bool `name:"scaleInstancePool" description:"Scale an Instance Pool"`
}
// Response returns an empty structure to unmarshal an Instance Pool scaling API response into.
func (ScaleInstancePool) Response() interface{} {
return new(BooleanResponse)
}
// DestroyInstancePool represents an Instance Pool destruction API request.
type DestroyInstancePool struct {
ID *UUID `json:"id"`
ZoneID *UUID `json:"zoneid"`
_ bool `name:"destroyInstancePool" description:"Destroy an Instance Pool"`
}
// Response returns an empty structure to unmarshal an Instance Pool destruction API response into.
func (DestroyInstancePool) Response() interface{} {
return new(BooleanResponse)
}
// GetInstancePool retrieves an Instance Pool's details.
type GetInstancePool struct {
ID *UUID `json:"id"`
ZoneID *UUID `json:"zoneid"`
_ bool `name:"getInstancePool" description:"Get an Instance Pool"`
}
// GetInstancePoolResponse get Instance Pool API response.
type GetInstancePoolResponse struct {
Count int
InstancePools []InstancePool `json:"instancepool"`
}
// Response returns an empty structure to unmarshal an Instance Pool get API response into.
func (GetInstancePool) Response() interface{} {
return new(GetInstancePoolResponse)
}
// ListInstancePools represents a list Instance Pool API request.
type ListInstancePools struct {
ZoneID *UUID `json:"zoneid"`
_ bool `name:"listInstancePools" description:"List Instance Pools"`
}
// ListInstancePoolsResponse represents a list Instance Pool API response.
type ListInstancePoolsResponse struct {
Count int
InstancePools []InstancePool `json:"instancepool"`
}
// Response returns an empty structure to unmarshal an Instance Pool list API response into.
func (ListInstancePools) Response() interface{} {
return new(ListInstancePoolsResponse)
}
// EvictInstancePoolMembers represents an Instance Pool members eviction API request.
type EvictInstancePoolMembers struct {
ID *UUID `json:"id"`
ZoneID *UUID `json:"zoneid"`
MemberIDs []UUID `json:"memberids"`
_ bool `name:"evictInstancePoolMembers" description:"Evict some Instance Pool members"`
}
// Response returns an empty structure to unmarshal an Instance Pool members eviction API response into.
func (EvictInstancePoolMembers) Response() interface{} {
return new(BooleanResponse)
}