def devices(self):
        if isinstance(self._values['devices'], basestring):
            collection = self._get_device_collection()
            result = self._get_device_selflinks([str(self._values['devices'])], collection)
            return result
        elif all('deviceReference' in x for x in self._values['devices']):
            # Case for the REST API
            result = []
            for item in self._values['devices']:
                member = defaultdict(lambda: None)
                member['deviceReference'] = str(item['deviceReference']['link'])

                # This can happen when you delete a device without deleting its associated
                # license from iWorkflow. iWorkflow doesnt clean anythign up. le sigh...
                if 'hostname' in item['deviceReference']:
                    member['hostname'] = str(item['deviceReference']['hostname'])
                if 'address' in item['deviceReference']:
                    member['address'] = str(item['deviceReference']['address'])
                if 'managementAddress' in item['deviceReference']:
                    member['managementAddress'] = str(item['deviceReference']['managementAddress'])
                if 'selfLink' in item['deviceReference']:
                    member['selfLink'] = str(item['selfLink'])
                result.append(member)
            return result
        else:
            collection = self._get_device_collection()
            result = self._get_device_selflinks(self._values['devices'], collection)
            return result
Ejemplo n.º 2
0
 def __init__(self, params=None):
     self._values = defaultdict(lambda: None)
     self._values['__warnings'] = []
     if params:
         self.update(params=params)
Ejemplo n.º 3
0
 def __init__(self, params=None, client=None):
     self.client = client
     self._values = defaultdict(lambda: None)
     if params:
         self.update(params)
Ejemplo n.º 4
0
 def __init__(self, *args, **kwargs):
     self.client = kwargs.pop('client', None)
     self._values = defaultdict(lambda: None)
Ejemplo n.º 5
0
 def __init__(self, params=None):
     self._values = defaultdict(lambda: None)
     if params:
         self.update(params=params)
Ejemplo n.º 6
0
 def __init__(self, params=None):
     self._values = defaultdict(lambda: None)
     self._values['__warnings'] = []
     if params:
         self.update(params=params)
 def __init__(self, *args, **kwargs):
     self.client = kwargs.pop('client', None)
     self._values = defaultdict(lambda: None)
     self.connectors = []