self.client.reboot_server(int(server_id), self.options.hard)
-@command(api='asterias')
+@command(api='cyclades')
class server_start(object):
"""start server"""
self.client.start_server(int(server_id))
-@command(api='asterias')
+@command(api='cyclades')
class server_shutdown(object):
"""shutdown server"""
self.client.shutdown_server(int(server_id))
-@command(api='asterias')
+@command(api='cyclades')
class server_console(object):
"""get a VNC console"""
print_dict(reply)
-@command(api='asterias')
+@command(api='cyclades')
class server_firewall(object):
"""set the firewall profile"""
self.client.set_firewall_profile(int(server_id), profile)
-@command(api='asterias')
+@command(api='cyclades')
class server_addr(object):
"""list server addresses"""
self.client.delete_server_metadata(int(server_id), key)
-@command(api='asterias')
+@command(api='cyclades')
class server_stats(object):
"""get server statistics"""
@command(api='compute')
-class image_create(object):
- """create image"""
-
- def main(self, server_id, name):
- reply = self.client.create_image(int(server_id), name)
- print_dict(reply)
-
-
-@command(api='compute')
class image_delete(object):
"""delete image"""
self.client.delete_image_metadata(image_id, key)
-@command(api='asterias')
+@command(api='cyclades')
class network_list(object):
"""list networks"""
print_items(networks)
-@command(api='asterias')
+@command(api='cyclades')
class network_create(object):
"""create a network"""
print_dict(reply)
-@command(api='asterias')
+@command(api='cyclades')
class network_info(object):
"""get network details"""
print_dict(network)
-@command(api='asterias')
+@command(api='cyclades')
class network_rename(object):
"""update network name"""
self.client.update_network_name(network_id, new_name)
-@command(api='asterias')
+@command(api='cyclades')
class network_delete(object):
"""delete a network"""
self.client.delete_network(network_id)
-@command(api='asterias')
+@command(api='cyclades')
class network_connect(object):
"""connect a server to a network"""
self.client.connect_server(server_id, network_id)
-@command(api='asterias')
+@command(api='cyclades')
class network_disconnect(object):
"""disconnect a server from a network"""
import json
+from . import ClientError
from .http import HTTPClient
path = '/images/detail' if detail else '/images'
reply = self.http_get(path)
return reply['images']['values']
-
+
def get_image_details(self, image_id):
- path = '/images/%d' % image_id
+ path = '/images/%s' % image_id
reply = self.http_get(path)
return reply['image']
-
- def create_image(self, server_id, name):
- req = {'name': name, 'serverRef': server_id}
- body = json.dumps({'image': req})
- reply = self.http_post('/images', body)
- return reply['image']
-
+
def delete_image(self, image_id):
- path = '/images/%d' % image_id
+ path = '/images/%s' % image_id
self.http_delete(path)
def get_image_metadata(self, image_id, key=None):
- path = '/images/%d/meta' % image_id
+ path = '/images/%s/meta' % image_id
if key:
path += '/%s' % key
reply = self.http_get(path)
return reply['meta'] if key else reply['metadata']['values']
def create_image_metadata(self, image_id, key, val):
- path = '/images/%d/meta/%s' % (image_id, key)
+ path = '/images/%s/meta/%s' % (image_id, key)
body = json.dumps({'meta': {key: val}})
reply = self.http_put(path, body, success=201)
- reply['meta']
+ return reply['meta']
def update_image_metadata(self, image_id, **metadata):
- path = '/images/%d/meta' % image_id
+ path = '/images/%s/meta' % image_id
body = json.dumps({'metadata': metadata})
reply = self.http_post(path, body, success=201)
return reply['metadata']
def delete_image_metadata(self, image_id, key):
- path = '/images/%d/meta/%s' % (image_id, key)
- reply = self.http_delete(path)
+ path = '/images/%s/meta/%s' % (image_id, key)
+ self.http_delete(path)