當前位置: 首頁>>代碼示例>>Python>>正文


Python Interface.remove方法代碼示例

本文整理匯總了Python中networkapi.interface.models.Interface.remove方法的典型用法代碼示例。如果您正苦於以下問題:Python Interface.remove方法的具體用法?Python Interface.remove怎麽用?Python Interface.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在networkapi.interface.models.Interface的用法示例。


在下文中一共展示了Interface.remove方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: handle_delete

# 需要導入模塊: from networkapi.interface.models import Interface [as 別名]
# 或者: from networkapi.interface.models.Interface import remove [as 別名]
    def handle_delete(self, request, user, *args, **kwargs):
        """Trata uma requisição DELETE para excluir uma interface

        URL: /interface/<id_interface>/ 

        """
        # Get request data and check permission
        try:
            # Valid Interface ID
            id_interface = kwargs.get("id_interface")
            if not is_valid_int_greater_zero_param(id_interface):
                self.log.error(u"The id_interface parameter is not a valid value: %s.", id_interface)
                raise InvalidValueError(None, "id_interface", id_interface)

            # Get interface and equipment to check permission
            interface = Interface.get_by_pk(id_interface)
            id_equipamento = interface.equipamento_id

            # Check permission
            if not has_perm(
                user,
                AdminPermission.EQUIPMENT_MANAGEMENT,
                AdminPermission.WRITE_OPERATION,
                None,
                id_equipamento,
                AdminPermission.EQUIP_WRITE_OPERATION,
            ):
                return self.not_authorized()

            with distributedlock(LOCK_INTERFACE % id_interface):

                # Remove interface
                Interface.remove(user, id_interface)

                return self.response(dumps_networkapi({}))

        except InvalidValueError, e:
            return self.response_error(269, e.param, e.value)
開發者ID:marcelometal,項目名稱:GloboNetworkAPI,代碼行數:40,代碼來源:InterfaceResource.py


注:本文中的networkapi.interface.models.Interface.remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。