def delete(self, request, *args, **kwargs): """ 删除组件标签 --- parameters: - name: tenantName description: 租户名 required: true type: string paramType: path - name: serviceAlias description: 组件别名 required: true type: string paramType: path - name: label_id description: 组件标签 id required: true type: string paramType: form """ label_id = request.data.get("label_id", None) if not label_id: return Response(general_message(400, "param error", "标签ID未指定"), status=400) service_label = service_label_repo.get_service_label(self.service.service_id, label_id) if not service_label: return Response(general_message(400, "tag does not exist", "标签不存在"), status=400) code, msg, event = label_service.delete_service_label(self.tenant, self.service, label_id, self.user.nick_name) if code != 200: return Response(general_message(code, "add labels error", msg), status=code) result = general_message(200, "success", "标签删除成功") return Response(result, status=result["code"])
def delete(self, request, *args, **kwargs): """ 删除服务标签 --- parameters: - name: tenantName description: 租户名 required: true type: string paramType: path - name: serviceAlias description: 服务别名 required: true type: string paramType: path - name: label_id description: 服务标签 id required: true type: string paramType: form """ result = {} try: label_id = request.data.get("label_id", None) if not label_id: return Response(general_message(400, "param error", "标签ID未指定"), status=400) code, msg, event = label_service.delete_service_label( self.tenant, self.service, self.user, label_id) if code != 200: return Response(general_message(code, "add labels error", msg), status=code) result = general_message(200, "success", "标签删除成功") except Exception as e: logger.exception(e) result = error_message(e.message) return Response(result, status=result["code"])