def get_all(self, service_id=None, field_id=None, group_id=None, no_group=False, tenant_id=None, filter_tenant=False): """Get the threshold list :param service_id: Service UUID to filter on. :param field_id: Field UUID to filter on. :param group_id: Group UUID to filter on. :param no_group: Filter on orphaned thresholds. :param tenant_id: Tenant UUID to filter on. :param filter_tenant: Explicitly filter on tenant (default is to not filter on tenant). Useful if you want to filter on tenant being None. :return: List of every thresholds. """ hashmap = db_api.get_instance() threshold_list = [] search_opts = dict() if filter_tenant: search_opts['tenant_uuid'] = tenant_id thresholds_uuid_list = hashmap.list_thresholds(service_uuid=service_id, field_uuid=field_id, group_uuid=group_id, **search_opts) for threshold_uuid in thresholds_uuid_list: threshold_db = hashmap.get_threshold(uuid=threshold_uuid) threshold_list.append( threshold_models.Threshold(**threshold_db.export_model())) res = threshold_models.ThresholdCollection(thresholds=threshold_list) return res
def thresholds(self, group_id): """Get the thresholds attached to the group. :param group_id: UUID of the group to filter on. """ hashmap = db_api.get_instance() threshold_list = [] thresholds_uuid_list = hashmap.list_thresholds(group_uuid=group_id) for threshold_uuid in thresholds_uuid_list: threshold_db = hashmap.get_threshold(uuid=threshold_uuid) threshold_list.append( threshold_models.Threshold(**threshold_db.export_model())) res = threshold_models.ThresholdCollection(thresholds=threshold_list) return res
def get_all(self, service_id=None, field_id=None, group_id=None, no_group=False): """Get the threshold list :param service_id: Service UUID to filter on. :param field_id: Field UUID to filter on. :param group_id: Group UUID to filter on. :param no_group: Filter on orphaned thresholds. :return: List of every thresholds. """ hashmap = db_api.get_instance() threshold_list = [] thresholds_uuid_list = hashmap.list_thresholds(service_uuid=service_id, field_uuid=field_id, group_uuid=group_id) for threshold_uuid in thresholds_uuid_list: threshold_db = hashmap.get_threshold(uuid=threshold_uuid) threshold_list.append( threshold_models.Threshold(**threshold_db.export_model())) res = threshold_models.ThresholdCollection(thresholds=threshold_list) return res