本文整理汇总了Python中st2common.persistence.trigger.TriggerType.delete方法的典型用法代码示例。如果您正苦于以下问题:Python TriggerType.delete方法的具体用法?Python TriggerType.delete怎么用?Python TriggerType.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st2common.persistence.trigger.TriggerType
的用法示例。
在下文中一共展示了TriggerType.delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete
# 需要导入模块: from st2common.persistence.trigger import TriggerType [as 别名]
# 或者: from st2common.persistence.trigger.TriggerType import delete [as 别名]
def delete(self, triggertype_ref_or_id):
"""
Delete a triggertype.
Handles requests:
DELETE /triggertypes/1
DELETE /triggertypes/pack.name
"""
LOG.info('DELETE /triggertypes/ with ref_or_id=%s',
triggertype_ref_or_id)
triggertype_db = self._get_by_ref_or_id(ref_or_id=triggertype_ref_or_id)
triggertype_id = triggertype_db.id
try:
validate_not_part_of_system_pack(triggertype_db)
except ValueValidationException as e:
abort(http_client.BAD_REQUEST, six.text_type(e))
try:
TriggerType.delete(triggertype_db)
except Exception as e:
LOG.exception('Database delete encountered exception during delete of id="%s". ',
triggertype_id)
abort(http_client.INTERNAL_SERVER_ERROR, six.text_type(e))
return
else:
extra = {'triggertype': triggertype_db}
LOG.audit('TriggerType deleted. TriggerType.id=%s' % (triggertype_db.id), extra=extra)
if not triggertype_db.parameters_schema:
TriggerTypeController._delete_shadow_trigger(triggertype_db)
return Response(status=http_client.NO_CONTENT)