本文整理汇总了Python中st2common.persistence.actionalias.ActionAlias.delete方法的典型用法代码示例。如果您正苦于以下问题:Python ActionAlias.delete方法的具体用法?Python ActionAlias.delete怎么用?Python ActionAlias.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st2common.persistence.actionalias.ActionAlias
的用法示例。
在下文中一共展示了ActionAlias.delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete
# 需要导入模块: from st2common.persistence.actionalias import ActionAlias [as 别名]
# 或者: from st2common.persistence.actionalias.ActionAlias import delete [as 别名]
def delete(self, ref_or_id, requester_user):
"""
Delete an action alias.
Handles requests:
DELETE /actionalias/1
"""
action_alias_db = self._get_by_ref_or_id(ref_or_id=ref_or_id)
LOG.debug('DELETE /actionalias/ lookup with id=%s found object: %s', ref_or_id,
action_alias_db)
permission_type = PermissionType.ACTION_ALIAS_DELETE
rbac_utils = get_rbac_backend().get_utils_class()
rbac_utils.assert_user_has_resource_db_permission(user_db=requester_user,
resource_db=action_alias_db,
permission_type=permission_type)
try:
ActionAlias.delete(action_alias_db)
except Exception as e:
LOG.exception('Database delete encountered exception during delete of id="%s".',
ref_or_id)
abort(http_client.INTERNAL_SERVER_ERROR, six.text_type(e))
return
extra = {'action_alias_db': action_alias_db}
LOG.audit('Action alias deleted. ActionAlias.id=%s.' % (action_alias_db.id), extra=extra)
return Response(status=http_client.NO_CONTENT)
示例2: delete
# 需要导入模块: from st2common.persistence.actionalias import ActionAlias [as 别名]
# 或者: from st2common.persistence.actionalias.ActionAlias import delete [as 别名]
def delete(self, action_alias_ref_or_id):
"""
Delete an action alias.
Handles requests:
DELETE /actionalias/1
"""
action_alias_db = self._get_by_ref_or_id(ref_or_id=action_alias_ref_or_id)
LOG.debug("DELETE /actionalias/ lookup with id=%s found object: %s", action_alias_ref_or_id, action_alias_db)
try:
ActionAlias.delete(action_alias_db)
except Exception as e:
LOG.exception('Database delete encountered exception during delete of id="%s".', action_alias_ref_or_id)
pecan.abort(http_client.INTERNAL_SERVER_ERROR, str(e))
return
extra = {"action_alias_db": action_alias_db}
LOG.audit("Action alias deleted. ActionAlias.id=%s." % (action_alias_db.id), extra=extra)