Ejemplo n.º 1
0
 def delete(self, request, *args, **kwargs):
     """
     放弃创建compose组组件
     ---
     parameters:
         - name: tenantName
           description: 租户名
           required: true
           type: string
           paramType: path
         - name: group_id
           description: 组ID
           required: true
           type: string
           paramType: path
         - name: compose_id
           description: group_compose id
           required: true
           type: string
           paramType: form
     """
     compose_id = request.data.get("compose_id", None)
     group_id = kwargs.get("group_id", None)
     try:
         group_id = int(group_id)
     except ValueError:
         raise ServiceHandleException(msg="group id is invalid",
                                      msg_show="参数不合法")
     if group_id:
         if group_id < 1:
             return Response(general_message(400, "params error",
                                             "所在组参数错误 "),
                             status=400)
     else:
         return Response(general_message(400, "params error",
                                         "请指明需要删除的组标识 "),
                         status=400)
     if not compose_id:
         return Response(general_message(400, "params error",
                                         "请指明需要删除的compose ID "),
                         status=400)
     compose_service.give_up_compose_create(self.tenant, group_id,
                                            compose_id)
     result = general_message(200, "compose delete success", "删除成功")
     return Response(result, status=result["code"])
Ejemplo n.º 2
0
 def delete(self, request, *args, **kwargs):
     """
     放弃创建compose组应用
     ---
     parameters:
         - name: tenantName
           description: 租户名
           required: true
           type: string
           paramType: path
         - name: group_id
           description: 组ID
           required: true
           type: string
           paramType: path
         - name: compose_id
           description: group_compose id
           required: true
           type: string
           paramType: form
     """
     try:
         compose_id = request.data.get("compose_id", None)
         group_id = kwargs.get("group_id", None)
         if group_id:
             if group_id < 1:
                 return Response(general_message(400, "params error",
                                                 "所在组参数错误 "),
                                 status=400)
         else:
             return Response(general_message(400, "params error",
                                             "请指明需要删除的组标识 "),
                             status=400)
         if not compose_id:
             return Response(general_message(400, "params error",
                                             "请指明需要删除的compose ID "),
                             status=400)
         compose_service.give_up_compose_create(self.tenant, group_id,
                                                compose_id)
         result = general_message(200, "compose delete success", "删除成功")
     except Exception as e:
         logger.exception(e)
         result = error_message("{0}".format(e))
     return Response(result, status=result["code"])