当前位置: 首页>>代码示例>>Python>>正文


Python ActionAlias.delete方法代码示例

本文整理汇总了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)
开发者ID:StackStorm,项目名称:st2,代码行数:31,代码来源:actionalias.py

示例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)
开发者ID:Pulsant,项目名称:st2,代码行数:20,代码来源:actionalias.py


注:本文中的st2common.persistence.actionalias.ActionAlias.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。