def list(self): """List all accounts with non-deleted instances""" dbaas = common.get_client() try: _pretty_print(dbaas.accounts.index()._info) except: print sys.exc_info()[1]
def delete(self, id, dbname): """Delete a database""" dbaas = common.get_client() try: dbaas.databases.delete(id, dbname) except: print sys.exc_info()[1]
def enabled(self, id): """Check the instance for root access""" dbaas = common.get_client() try: _pretty_print(dbaas.root.is_root_enabled(id)) except: print sys.exc_info()[1]
def delete(self, id, user): """Delete the specified user""" dbaas = common.get_client() try: dbaas.users.delete(id, user) except: print sys.exc_info()[1]
def reboot(self, id): """Reboot the instance.""" dbaas = common.get_client() try: result = dbaas.management.reboot(id) except: print sys.exec_info()[1]
def stop(self, id): """Stop MySQL on the given instance.""" dbaas = common.get_client() try: result = dbaas.management.stop(id) except: print sys.exc_info()[1]
def get(self, acct): """List details for the account provided""" dbaas = common.get_client() try: _pretty_print(dbaas.accounts.show(acct)._info) except: print sys.exc_info()[1]
def get(self, id): """Get details for the specified instance""" dbaas = common.get_client() try: _pretty_print(dbaas.instances.get(id)._info) except: print sys.exc_info()[1]
def get(self, name): """List details for the specified host""" dbaas = common.get_client() try: _pretty_print(dbaas.hosts.get(name)._info) except: print sys.exc_info()[1]
def get(self, id): """List details for the instance.""" dbaas = common.get_client() try: result = dbaas.management.show(id) _pretty_print(result._info) except: print sys.exc_info()[1]
def create(self, id, dbname): """Create a database""" dbaas = common.get_client() try: databases = [{'name': dbname}] dbaas.databases.create(id, databases) except: print sys.exc_info()[1]
def list(self): """List the available flavors""" dbaas = common.get_client() try: for flavor in dbaas.flavors.list(): _pretty_print(flavor._info) except: print sys.exc_info()[1]
def diagnostic(self, id): """List diagnostic details about an instance.""" dbaas = common.get_client() try: result = dbaas.diagnostics.get(id) _pretty_print(result._info) except: print sys.exc_info()[1]
def create(self, id): """Enable the instance's root user.""" dbaas = common.get_client() try: user, password = dbaas.root.create(id) print "User:\t\t%s\nPassword:\t%s" % (user, password) except: print sys.exc_info()[1]
def list(self): """List all compute hosts""" dbaas = common.get_client() try: for host in dbaas.hosts.index(): _pretty_print(host._info) except: print sys.exc_info()[1]
def list(self): """List details for the storage device""" dbaas = common.get_client() try: for storage in dbaas.storage.index(): _pretty_print(storage._info) except: print sys.exc_info()[1]
def list(self): """List all instances for account""" dbaas = common.get_client() try: for instance in dbaas.instances.list(): _pretty_print(instance._info) except: print sys.exc_info()[1]
def list(self, id): """List all the users for an instance""" dbaas = common.get_client() try: for user in dbaas.users.list(id): _pretty_print(user._info) except: print sys.exc_info()[1]
def history(self, id): """List root history for the instance.""" dbaas = common.get_client() try: result = dbaas.management.root_enabled_history(id) _pretty_print(result._info) except: print sys.exc_info()[1]
def list(self, id): """List the databases""" dbaas = common.get_client() try: for database in dbaas.databases.list(id): _pretty_print(database._info) except: print sys.exc_info()[1]
def restart(self, id): """Restart the database""" dbaas = common.get_client() try: result = dbaas.instances.restart(id) if result: print result except: print sys.exc_info()[1]
def resize_instance(self, id, flavor_id): """Resize an instance flavor""" dbaas = common.get_client() try: result = dbaas.instances.resize_instance(id, flavor_id) if result: print result except: print sys.exc_info()[1]
def resize_volume(self, id, size): """Resize an instance volume""" dbaas = common.get_client() try: result = dbaas.instances.resize_volume(id, size) if result: print result except: print sys.exc_info()[1]
def delete(self, id): """Delete the specified instance""" dbaas = common.get_client() try: result = dbaas.instances.delete(id) if result: print result except: print sys.exc_info()[1]
def list(self, url): """List all the supported versions""" dbaas = common.get_client() try: versions = dbaas.versions.index(url) for version in versions: _pretty_print(version._info) except: print sys.exc_info()[1]
def create(self, name, volume_size, flavorRef="http://localhost:8775/v1.0/flavors/1"): """Create a new instance""" dbaas = common.get_client() volume = {"size": volume_size} try: result = dbaas.instances.create(name, flavorRef, volume) _pretty_print(result._info) except: print sys.exc_info()[1]
def create(self, id, username, password, dbname, *args): """Create a user in instance, with access to one or more databases""" dbaas = common.get_client() try: databases = [{'name': dbname}] [databases.append({"name": db}) for db in args] users = [{'name': username, 'password': password, 'databases': databases}] dbaas.users.create(id, users) except: print sys.exc_info()[1]
def list(self, id, limit=None, marker=None): """List the databases""" dbaas = common.get_client() try: databases = dbaas.databases.list(id, limit, marker) for database in databases: _pretty_print(database._info) if databases.links: for link in databases.links: _pretty_print(link) except: print sys.exc_info()[1]
def list(self, id, limit=None, marker=None): """List all the users for an instance""" dbaas = common.get_client() try: users = dbaas.users.list(id, limit, marker) for user in users: _pretty_print(user._info) if users.links: for link in users.links: _pretty_print(link) except: print sys.exc_info()[1]
def list(self, limit=None, marker=None): """List all instances for account""" dbaas = common.get_client() if limit: limit = int(limit, 10) try: instances = dbaas.instances.list(limit, marker) for instance in instances: _pretty_print(instance._info) if instances.links: for link in instances.links: _pretty_print(link) except: print sys.exc_info()[1]
def create(self, id, username, password, dbname, *args): """Create a user in instance, with access to one or more databases""" dbaas = common.get_client() try: databases = [{'name': dbname}] [databases.append({"name": db}) for db in args] users = [{ 'name': username, 'password': password, 'databases': databases }] dbaas.users.create(id, users) except: print sys.exc_info()[1]