root / main / java / net / elasticgrid / rackspace / cloudservers / CloudServers.java @ af63e739
History | View | Annotate | Download (16 kB)
1 |
/**
|
---|---|
2 |
* Licensed to the Apache Software Foundation (ASF) under one
|
3 |
* or more contributor license agreements. See the NOTICE file
|
4 |
* distributed with this work for additional information
|
5 |
* regarding copyright ownership. The ASF licenses this file
|
6 |
* to you under the Apache License, Version 2.0 (the
|
7 |
* "License"); you may not use this file except in compliance
|
8 |
* with the License. You may obtain a copy of the License at
|
9 |
*
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0
|
11 |
*
|
12 |
* Unless required by applicable law or agreed to in writing,
|
13 |
* software distributed under the License is distributed on an
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15 |
* KIND, either express or implied. See the License for the
|
16 |
* specific language governing permissions and limitations
|
17 |
* under the License.
|
18 |
*/
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
20 |
|
21 |
import java.util.List; |
22 |
import java.util.Map; |
23 |
import java.net.InetAddress; |
24 |
|
25 |
/**
|
26 |
* Rackspace Cloud Servers API.
|
27 |
*
|
28 |
* @author Jerome Bernard
|
29 |
*/
|
30 |
public interface CloudServers { |
31 |
|
32 |
/**
|
33 |
* Retrieve the list of servers (only IDs and names) associated with the Rackspace account.
|
34 |
*
|
35 |
* @return the list of servers
|
36 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
37 |
*/
|
38 |
List<Server> getServers() throws CloudServersException; |
39 |
|
40 |
/**
|
41 |
* Retrieve the list of servers (with details) associated with the Rackspace account.
|
42 |
*
|
43 |
* @return the list of servers
|
44 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
45 |
*/
|
46 |
List<Server> getServersWithDetails() throws CloudServersException; |
47 |
|
48 |
/**
|
49 |
* Retrieve the server details.
|
50 |
*
|
51 |
* @param serverID the ID of the server for which details should be retrieved
|
52 |
* @return the server details
|
53 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
54 |
*/
|
55 |
Server getServerDetails(int serverID) throws CloudServersException; |
56 |
|
57 |
/**
|
58 |
* Retrieve server addresses.
|
59 |
*
|
60 |
* @param serverID the ID of the server for which addresses should be retrieved
|
61 |
* @return the server addresses
|
62 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
63 |
*/
|
64 |
Addresses getServerAddresses(int serverID) throws CloudServersException; |
65 |
|
66 |
/**
|
67 |
* Retrieve public server addresses.
|
68 |
*
|
69 |
* @param serverID the ID of the server for which addresses should be retrieved
|
70 |
* @return the server addresses
|
71 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
72 |
*/
|
73 |
List<InetAddress> getServerPublicAddresses(int serverID) throws CloudServersException; |
74 |
|
75 |
/**
|
76 |
* Retrieve private server addresses.
|
77 |
*
|
78 |
* @param serverID the ID of the server for which addresses should be retrieved
|
79 |
* @return the server addresses
|
80 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
81 |
*/
|
82 |
List<InetAddress> getServerPrivateAddresses(int serverID) throws CloudServersException; |
83 |
|
84 |
/**
|
85 |
* Share an IP address to the specified server.
|
86 |
*
|
87 |
* @param groupID the ID of the shared IP group
|
88 |
* @param serverID the ID of the server for which the IP should be shared
|
89 |
* @param address the IP¨address to share with the server
|
90 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
91 |
*/
|
92 |
void shareAddress(int groupID, int serverID, InetAddress address) throws CloudServersException; |
93 |
|
94 |
/**
|
95 |
* Share an IP address to the specified server.
|
96 |
*
|
97 |
* @param groupID the ID of the shared IP group
|
98 |
* @param serverID the ID of the server for which the IP should be shared
|
99 |
* @param address the IP¨address to share with the server
|
100 |
* @param configureServer if true the server is configured with the new address, though the new address is not
|
101 |
* enabled; configuring the server does require a reboot
|
102 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
103 |
*/
|
104 |
void shareAddress(int groupID, int serverID, InetAddress address, boolean configureServer) throws CloudServersException; |
105 |
|
106 |
/**
|
107 |
* Remove a shared IP address from the specified server.
|
108 |
*
|
109 |
* @param serverID the ID of the server for which the IP should be not be shared anymore
|
110 |
* @param address the IP¨address to stop sharing with the server
|
111 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
112 |
*/
|
113 |
void unshareAddress(int serverID, InetAddress address) throws CloudServersException; |
114 |
|
115 |
/**
|
116 |
* Provision a new server.
|
117 |
*
|
118 |
* @param name the name of the server to create
|
119 |
* @param imageID the image from which the server should be created
|
120 |
* @param flavorID the kind of hardware to use
|
121 |
* @return the created server with precious information such as admin password for that server
|
122 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
123 |
*/
|
124 |
Server createServer(String name, int imageID, int flavorID) throws CloudServersException; |
125 |
|
126 |
/**
|
127 |
* Provision a new server.
|
128 |
*
|
129 |
* @param name the name of the server to create
|
130 |
* @param imageID the image from which the server should be created
|
131 |
* @param flavorID the kind of hardware to use
|
132 |
* @param metadata the launch metadata
|
133 |
* @return the created server with precious information such as admin password for that server
|
134 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
135 |
*/
|
136 |
Server createServer(String name, int imageID, int flavorID, Map<String, String> metadata) throws CloudServersException; |
137 |
|
138 |
/**
|
139 |
* Reboot the specified server.
|
140 |
*
|
141 |
* @param serverID the ID of the server to reboot
|
142 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
143 |
* @see #rebootServer(int, RebootType)
|
144 |
*/
|
145 |
void rebootServer(int serverID) throws CloudServersException; |
146 |
|
147 |
/**
|
148 |
* Reboot the specified server.
|
149 |
*
|
150 |
* @param serverID the ID of the server to reboot
|
151 |
* @param type the type of reboot to perform
|
152 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
153 |
* @see #rebootServer(int, RebootType)
|
154 |
*/
|
155 |
void rebootServer(int serverID, RebootType type) throws CloudServersException; |
156 |
|
157 |
/**
|
158 |
* Rebuild the specified server.
|
159 |
*
|
160 |
* @param serverID the ID of the server to rebuild
|
161 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
162 |
* @see #rebuildServer(int, int)
|
163 |
*/
|
164 |
void rebuildServer(int serverID) throws CloudServersException; |
165 |
|
166 |
/**
|
167 |
* Rebuild the specified server from an different image than the one initially used.
|
168 |
*
|
169 |
* @param serverID the ID of the server to rebuild
|
170 |
* @param imageID the new image to use
|
171 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
172 |
* @see #rebuildServer(int)
|
173 |
*/
|
174 |
void rebuildServer(int serverID, int imageID) throws CloudServersException; |
175 |
|
176 |
/**
|
177 |
* Resize the specified server.
|
178 |
*
|
179 |
* @param serverID the ID of the server to resize
|
180 |
* @param flavorID the new flavor of hardware which should be used
|
181 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
182 |
*/
|
183 |
void resizeServer(int serverID, int flavorID) throws CloudServersException; |
184 |
|
185 |
/**
|
186 |
* Confirm a pending resize action.
|
187 |
*
|
188 |
* @param serverID the ID of the server for which the resize should be confirmed
|
189 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
190 |
*/
|
191 |
void confirmResize(int serverID) throws CloudServersException; |
192 |
|
193 |
/**
|
194 |
* Cancel and revert a pending resize action.
|
195 |
*
|
196 |
* @param serverID the ID of the server for which the resize should be cancelled
|
197 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
198 |
*/
|
199 |
void revertResize(int serverID) throws CloudServersException; |
200 |
|
201 |
/**
|
202 |
* Update the specified server's name and/or administrative password. This operation allows you to update the name
|
203 |
* of the server and change the administrative password. This operation changes the name of the server in the Cloud
|
204 |
* Servers system and does not change the server host name itself.
|
205 |
*
|
206 |
* @param serverID the ID of the server to update
|
207 |
* @param name the new name for the server
|
208 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
209 |
*/
|
210 |
void updateServerName(int serverID, String name) throws CloudServersException; |
211 |
|
212 |
/**
|
213 |
* Update the specified server's name and/or administrative password. This operation allows you to update the name
|
214 |
* of the server and change the administrative password. This operation changes the name of the server in the Cloud
|
215 |
* Servers system and does not change the server host name itself.
|
216 |
*
|
217 |
* @param serverID the ID of the server to update
|
218 |
* @param password the new password
|
219 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
220 |
*/
|
221 |
void updateServerPassword(int serverID, String password) throws CloudServersException; |
222 |
|
223 |
/**
|
224 |
* Update the specified server's name and/or administrative password. This operation allows you to update the name
|
225 |
* of the server and change the administrative password. This operation changes the name of the server in the Cloud
|
226 |
* Servers system and does not change the server host name itself.
|
227 |
*
|
228 |
* @param serverID the ID of the server to update
|
229 |
* @param name the new name for the server
|
230 |
* @param password the new password
|
231 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
232 |
*/
|
233 |
void updateServerNameAndPassword(int serverID, String name, String password) throws CloudServersException; |
234 |
|
235 |
/**
|
236 |
* Deletes a cloud server instance from the system
|
237 |
*
|
238 |
* @param serverID the ID of the server to delete
|
239 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
240 |
*/
|
241 |
void deleteServer(int serverID) throws CloudServersException; |
242 |
|
243 |
/**
|
244 |
* Return the limits for the Rackspace API account.
|
245 |
*
|
246 |
* @return the limits
|
247 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
248 |
*/
|
249 |
Limits getLimits() throws CloudServersException;
|
250 |
|
251 |
/**
|
252 |
* Retrieve the list of flavors (only IDs and names) associated with the Rackspace account.
|
253 |
*
|
254 |
* @return the flavors
|
255 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
256 |
*/
|
257 |
List<Flavor> getFlavors() throws CloudServersException; |
258 |
|
259 |
/**
|
260 |
* Retrieve the list of flavors (with details) associated with the Rackspace account.
|
261 |
*
|
262 |
* @return the flavors
|
263 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
264 |
*/
|
265 |
List<Flavor> getFlavorsWithDetails() throws CloudServersException; |
266 |
|
267 |
/**
|
268 |
* Retrieve the flavor details.
|
269 |
*
|
270 |
* @param flavorID the ID of the flavor for which details should be retrieved
|
271 |
* @return the flavor details
|
272 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
273 |
*/
|
274 |
Flavor getFlavorDetails(int flavorID) throws CloudServersException; |
275 |
|
276 |
/**
|
277 |
* Retrieve the list of images (only IDs and names) associated with the Rackspace account.
|
278 |
*
|
279 |
* @return the images
|
280 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
281 |
*/
|
282 |
List<Image> getImages() throws CloudServersException; |
283 |
|
284 |
/**
|
285 |
* Retrieve the list of images (with details) associated with the Rackspace account.
|
286 |
*
|
287 |
* @return the images
|
288 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
289 |
*/
|
290 |
List<Image> getImagesWithDetails() throws CloudServersException; |
291 |
|
292 |
/**
|
293 |
* Retrieve the image details.
|
294 |
*
|
295 |
* @param imageID the ID of the image for which details should be retrieved
|
296 |
* @return the image details
|
297 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
298 |
*/
|
299 |
Image getImageDetails(int imageID) throws CloudServersException; |
300 |
|
301 |
/**
|
302 |
* Create a new image from a server.
|
303 |
*
|
304 |
* @param name the name of the image to create
|
305 |
* @param serverID the ID of the server whose content will be used for creating the image
|
306 |
* @return the created image details
|
307 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
308 |
*/
|
309 |
Image createImage(String name, int serverID) throws CloudServersException; |
310 |
|
311 |
/**
|
312 |
* Retrieve the backup schedule for a server.
|
313 |
*
|
314 |
* @param serverID the ID of the server for which the backup schedule should be retrieved
|
315 |
* @return the backup schedule
|
316 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
317 |
*/
|
318 |
BackupSchedule getBackupSchedule(int serverID) throws CloudServersException; |
319 |
|
320 |
/**
|
321 |
* Create or update backup schedule for a server.
|
322 |
*
|
323 |
* @param serverID the ID of the server for which the backup schedule should be created/updated
|
324 |
* @param schedule the backup schedule
|
325 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
326 |
*/
|
327 |
void scheduleBackup(int serverID, BackupSchedule schedule) throws CloudServersException; |
328 |
|
329 |
/**
|
330 |
* Delete backup schedule for a server.
|
331 |
*
|
332 |
* @param serverID the ID of the server for which the backup schedule should be deleted
|
333 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
334 |
*/
|
335 |
void deleteBackupSchedule(int serverID) throws CloudServersException; |
336 |
|
337 |
/**
|
338 |
* Retrieve the list of shared IP groups (only IDs and names) associated with the Rackspace account.
|
339 |
*
|
340 |
* @return the list of shared IP groups
|
341 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
342 |
*/
|
343 |
List<SharedIPGroup> getSharedIPGroups() throws CloudServersException; |
344 |
|
345 |
/**
|
346 |
* Retrieve the list of shared IP groups (with details) associated with the Rackspace account.
|
347 |
*
|
348 |
* @return the list of shared IP groups
|
349 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
350 |
*/
|
351 |
List<SharedIPGroup> getSharedIPGroupsWithDetails() throws CloudServersException; |
352 |
|
353 |
/**
|
354 |
* Retrieve the shared IP group details.
|
355 |
*
|
356 |
* @param groupID the ID of the shared IP group
|
357 |
* @return the shared IP group
|
358 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
359 |
*/
|
360 |
SharedIPGroup getSharedIPGroup(int groupID) throws CloudServersException; |
361 |
|
362 |
/**
|
363 |
* Create a new shared IP group.
|
364 |
*
|
365 |
* @param name the name of the shared IP group to create
|
366 |
* @return the created shared IP group
|
367 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
368 |
* @see #createSharedIPGroup(String, int)
|
369 |
*/
|
370 |
SharedIPGroup createSharedIPGroup(String name) throws CloudServersException; |
371 |
|
372 |
/**
|
373 |
* Create a new shared IP group.
|
374 |
*
|
375 |
* @param name the name of the shared IP group to create
|
376 |
* @param serverID the first server which is going to be part of the group
|
377 |
* @return the created shared IP group
|
378 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
379 |
* @see #createSharedIPGroup(String)
|
380 |
*/
|
381 |
SharedIPGroup createSharedIPGroup(String name, int serverID) throws CloudServersException; |
382 |
|
383 |
/**
|
384 |
* Delete shared IP group.
|
385 |
*
|
386 |
* @param groupID the ID of the shared IP group
|
387 |
* @throws CloudServersException if there is an exception when calling the Cloud Servers API
|
388 |
*/
|
389 |
void deleteSharedIPGroup(int groupID) throws CloudServersException; |
390 |
|
391 |
} |