def purchase_ip(self): """ Return an ip object representing a new bought IP @return (Ip): Ip object """ json_scheme = self.gen_def_json_scheme('SetPurchaseIpAddress') json_obj = self.call_method_post(method='SetPurchaseIpAddress', json_scheme=json_scheme) try: ip = Ip() ip.ip_addr = json_obj['Value']['Value'] ip.resid = json_obj['Value']['ResourceId'] return ip except: raise Exception('Unknown error retrieving IP.')
def purchase_ip(self, debug=False): """ Return an ip object representing a new bought IP @param debug [Boolean] if true, request and response will be printed @return (Ip): Ip object """ json_scheme = self.gen_def_json_scheme('SetPurchaseIpAddress') json_obj = self.call_method_post(method='SetPurchaseIpAddress', json_scheme=json_scheme, debug=debug) try: ip = Ip() ip.ip_addr = json_obj['Value']['Value'] ip.resid = json_obj['Value']['ResourceId'] return ip except: raise Exception('Unknown error retrieving IP.')
def get_ip(self): """ Retrieve a complete list of bought ip address related only to PRO Servers. It create an internal object (Iplist) representing all of the ips object iterated form the WS. @param: None @return: None """ json_scheme = self.gen_def_json_scheme('GetPurchasedIpAddresses') json_obj = self.call_method_post(method='GetPurchasedIpAddresses ', json_scheme=json_scheme) self.iplist = IpList() for ip in json_obj['Value']: r = Ip() r.ip_addr = ip['Value'] r.resid = ip['ResourceId'] r.serverid = ip['ServerId'] if 'None' not in str(ip['ServerId']) else None self.iplist.append(r)
def get_ip(self): """ Retrieve a complete list of bought ip address related only to PRO Servers. It create an internal object (Iplist) representing all of the ips object iterated form the WS. @param: None @return: None """ json_scheme = self.gen_def_json_scheme('GetPurchasedIpAddresses') json_obj = self.call_method_post(method='GetPurchasedIpAddresses ', json_scheme=json_scheme) self.iplist = IpList() for ip in json_obj['Value']: r = Ip() r.ip_addr = ip['Value'] r.resid = ip['ResourceId'] r.serverid = ip['ServerId'] if 'None' not in str( ip['ServerId']) else None self.iplist.append(r)
def __init__(self, interface, sid): super(Pro, self).__init__(interface) self.cltype = 'pro' self.sid = sid self.ip_addr = Ip() # Load HD information self.hds = [] _hds = self.interface.get_server_detail(self.sid)['VirtualDisks'] for hd in _hds: self.hds.append(hd)
def __init__(self, interface, sid): super(Smart, self).__init__(interface) self.cltype = 'smart' self.sid = sid self.ip_addr = Ip() self.package = None