def list(self): """ list all servers """ return request(API_LIST.SERVERS_LIST.value, { 'email': self.email, 'token': self.token })
def list(self): """ list ssh keys """ return request(API_LIST.SSH_LIST.value, { 'email': self.email, 'token': self.token })
def delete(self): """ delete ssh key """ return request(API_LIST.SSH_DELETE.value, { 'email': self.email, 'token': self.token })
def get(self, uuid): """ get one server by uuid """ return request(API_LIST.SERVER_GET.value, { 'email': self.email, 'token': self.token, 'uuid': uuid })
def delete(self, unique_id): """ delete dns config by id """ return request(API_LIST.DNS_DELETE.value, { 'email': self.email, 'token': self.token, 'id': unique_id })
def delete(self, uuid): """ delete a server by uuid(no confirm or recycle bin!!) """ return request(API_LIST.SERVER_DELETE.value, { 'email': self.email, 'token': self.token, 'uuid': uuid })
def list(self, domain): """ list dns config by domain name """ return request(API_LIST.DNS_LIST.value, { 'email': self.email, 'token': self.token, 'domain': domain })
def set_power(self, uuid, power): """ set power for server by uuid """ return request(API_LIST.SERVER_SET_POWER.value, { 'email': self.email, 'token': self.token, 'uuid': uuid, 'power': power })
def create(self, name, key): """ create ssh key """ return request(API_LIST.SSH_CREATE.value, { 'email': self.email, 'token': self.token, 'name': name, 'key': key })
def reinstall(self, uuid, os, ssh_key): """ reinstall a server """ return request( API_LIST.SERVER_REINSTALL.value, { 'email': self.email, 'token': self.token, 'uuid': uuid, 'os': os, 'sshKey': ssh_key })
def get_io(self, uuid, start_time, unit, end_time=datetime.utcnow()): """ get monitor info for io """ return request( API_LIST.MONITOR_IO.value, { 'email': self.email, 'token': self.token, 'uuid': uuid, 'start_time': start_time, 'end_time': end_time, 'unit': unit })
def edit(self, unique_id, data, ttl=300, priority=5): """ edit dns config by id """ return request( API_LIST.DNS_EDIT.value, { 'email': self.email, 'token': self.token, 'id': unique_id, 'data': data, 'ttl': ttl, 'priority': priority })
def create(self, name, memory, area, os, ssh_key): """ create a server """ return request( API_LIST.SERVER_CREATE.value, { 'email': self.email, 'token': self.token, 'name': name, 'memory': memory, 'area': area, 'os': os, 'sshKey': ssh_key })
def add(self, domain, header, record_type, data, ttl=300, priority=5): """ add dns config by domain name """ return request( API_LIST.DNS_ADD.value, { 'email': self.email, 'token': self.token, 'domain': domain, 'header': header, 'type': record_type, 'data': data, 'ttl': ttl, 'priority': priority })
def set(self, uuid, close_disk_virt_io, close_net_virt_io, iso, boot_order): """ set server by uuid """ return request( API_LIST.SERVER_SET.value, { 'email': self.email, 'token': self.token, 'uuid': uuid, 'closeDiskVirtIO': close_disk_virt_io, 'closeNetVirtIO': close_net_virt_io, 'iso': iso, 'bootOrder': boot_order })
def get_balance(self): """ get balance information for user """ return request(API_LIST.ACCOUNT_BALANCE.value, {'email': self.email, 'token': self.token})
def get_quota(self): """ get quota infomation for user """ return request(API_LIST.ACCOUNT_QUOTA.value, {'email': self.email, 'token': self.token})