Beispiel #1
0
    def post(self, request, *args, **kwargs):
        """
        重启服务
        ---
        parameters:
            - name: tenantName
              description: 租户名
              required: true
              type: string
              paramType: path
            - name: serviceAlias
              description: 服务别名
              required: true
              type: string
              paramType: path

        """
        try:
            code, msg, event = app_manage_service.restart(self.tenant, self.service, self.user)
            bean = {}
            if event:
                bean = event.to_dict()
                bean["type_cn"] = event_service.translate_event_type(event.type)
            if code != 200:
                return Response(general_message(code, "restart app error", msg, bean=bean), status=code)
            result = general_message(code, "success", "操作成功", bean=bean)
        except Exception as e:
            logger.exception(e)
            result = error_message(e.message)
        return Response(result, status=result["code"])
    def post(self, request, *args, **kwargs):
        """
        重启组件
        ---
        parameters:
            - name: tenantName
              description: 租户名
              required: true
              type: string
              paramType: path
            - name: serviceAlias
              description: 组件别名
              required: true
              type: string
              paramType: path

        """
        code, msg = app_manage_service.restart(
            self.tenant,
            self.service,
            self.user,
            oauth_instance=self.oauth_instance)
        bean = {}
        if code != 200:
            return Response(general_message(code,
                                            "restart app error",
                                            msg,
                                            bean=bean),
                            status=code)
        result = general_message(code, "success", "操作成功", bean=bean)
        return Response(result, status=result["code"])