def _build(self, data): """Build the variables in this object by pulling out the data from data """ for key, val in data.items(): if key == "task_id" and not val: self._task_id = None elif key == "task_id": self._task_id = Task(val) else: setattr(self, '_' + key, val)
def _build(self, data): for key, val in data.items(): if key == 'pool': pass elif key == "task_id" and not val: self._task_id = None elif key == "task_id": self._task_id = Task(val) else: setattr(self, '_' + key, val)
def _build(self, data): """Build this object from the data returned in an API response""" self._task_id = None for key, val in data.items(): if key == 'monitor': self._monitor = HealthMonitor(**val) elif key == 'active': self._active = Active(val) elif key == "task_id" and not val: self._task_id = None elif key == "task_id": self._task_id = Task(val) else: setattr(self, '_' + key, val)
def _build(self, data): """Build the neccesary substructures under this :class:`RTTM`""" for key, val in data.items(): if key == 'region': self._region = APIList(DynectSession.get_session, 'region') for region in val: code = region.pop('region_code', None) pool = region.pop('pool', None) status = region.pop('status', None) r = RTTMRegion(self._zone, self._fqdn, code, pool, **region) r._status = status self._region.append(r) elif key == 'monitor': if self._monitor is not None: self._monitor.zone = self._zone self._monitor.fqdn = self._fqdn else: proto = val.pop('protocol', None) inter = val.pop('interval', None) self._monitor = Monitor(proto, inter, **val) elif key == 'performance_monitor': if self._performance_monitor is not None: self._performance_monitor.zone = self._zone self._performance_monitor.fqdn = self._fqdn else: proto = val.pop('protocol', None) inter = val.pop('interval', None) self._performance_monitor = PerformanceMonitor(proto, inter, **val) elif key == 'notify_events': self._notify_events = [item.strip() for item in val.split(',')] elif key == 'active': self._active = Active(val) elif key == "task_id" and not val: self._task_id = None elif key == "task_id": self._task_id = Task(val) else: setattr(self, '_' + key, val) self._region.uri = self.uri