Example #1
0
 def list(self):
     """
     list all servers
     """
     return request(API_LIST.SERVERS_LIST.value, {
         'email': self.email,
         'token': self.token
     })
Example #2
0
 def list(self):
     """
     list ssh keys
     """
     return request(API_LIST.SSH_LIST.value, {
         'email': self.email,
         'token': self.token
     })
Example #3
0
 def delete(self):
     """
     delete ssh key
     """
     return request(API_LIST.SSH_DELETE.value, {
         'email': self.email,
         'token': self.token
     })
Example #4
0
 def get(self, uuid):
     """
     get one server by uuid
     """
     return request(API_LIST.SERVER_GET.value, {
         'email': self.email,
         'token': self.token,
         'uuid': uuid
     })
Example #5
0
 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
     })
Example #6
0
 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
     })
Example #7
0
 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
     })
Example #8
0
 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
     })
Example #9
0
 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
     })
Example #10
0
 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
         })
Example #11
0
 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
         })
Example #12
0
 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
         })
Example #13
0
 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
         })
Example #14
0
 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
         })
Example #15
0
 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
         })
Example #16
0
 def get_balance(self):
     """
     get balance information for user
     """
     return request(API_LIST.ACCOUNT_BALANCE.value, {'email': self.email, 'token': self.token})
Example #17
0
 def get_quota(self):
     """
     get quota infomation for user
     """
     return request(API_LIST.ACCOUNT_QUOTA.value, {'email': self.email, 'token': self.token})