def delete(self): """remove user rule""" user_rules_index = app.config['USER_RULES_INDEX'] _id = request.args.get("id", None) _rule_name = request.args.get("rule_name", None) if not _id and not _rule_name: return { "success": False, "message": "Must specify id or rule_name in the request" }, 400 if _id: mozart_es.delete_by_id(index=user_rules_index, id=_id, ignore=404) app.logger.info('user rule %s deleted' % _id) return {'success': True, 'message': 'user rule deleted', 'id': _id} elif _rule_name: query = {"query": {"match": {"rule_name": _rule_name}}} mozart_es.es.delete_by_query(index=user_rules_index, body=query, ignore=404) app.logger.info('user rule %s deleted' % _rule_name) return { 'success': True, 'message': 'user rule deleted', 'rule_name': _rule_name }
def get(self): """Remove container based on ID""" _id = request.form.get('id', request.args.get('id', None)) if _id is None: return {'success': False, 'message': 'id must be supplied'}, 400 mozart_es.delete_by_id(index=CONTAINERS_INDEX, id=_id) app.logger.info('Deleted container %s from index: %s' % (_id, CONTAINERS_INDEX)) return {'success': True, 'message': "job_spec deleted: %s" % _id}
def get(self): """Remove HySDS IO for the given ID""" _id = request.form.get('id', request.args.get('id', None)) if _id is None: return { 'success': False, 'message': 'id parameter not included' }, 400 mozart_es.delete_by_id(index=HYSDS_IOS_INDEX, id=_id) app.logger.info('deleted %s from index: %s' % (_id, HYSDS_IOS_INDEX)) return {'success': True, 'message': "deleted hysds_io: %s" % _id}
def get(self): """Remove Job Spec for the given ID""" _id = request.form.get('id', request.args.get('id', None)) if _id is None: return { 'success': False, 'message': 'id parameter not included' }, 400 mozart_es.delete_by_id(index=JOB_SPECS_INDEX, id=_id) app.logger.info('Deleted job_spec %s from index: %s' % (_id, JOB_SPECS_INDEX)) return {'success': True, 'message': "job spec removed: %s" % _id}