def get(self, request, team_name, *args, **kwargs):
        """
        获取应用访问信息
        ---
        parameters:
            - name: tenantName
              description: 租户名
              required: true
              type: string
              paramType: path
            - name: service_list
              description: 服务别名列表
              required: true
              type: string
              paramType: path
        """

        try:
            serviceAlias = request.GET.get('service_alias')
            if not serviceAlias:
                result = general_message(200, "not service", "当前组内无应用", bean={"is_null": True})
                return Response(result)
            team = team_services.get_tenant_by_tenant_name(team_name)
            service_access_list = list()
            if not team:
                result = general_message(400, "not tenant", "团队不存在")
                return Response(result)
            service_list = serviceAlias.split('-')
            for service_alias in service_list:
                bean = dict()
                service = service_repo.get_service_by_service_alias(service_alias)
                access_type, data = port_service.get_access_info(team, service)
                bean["access_type"] = access_type
                bean["access_info"] = data
                service_access_list.append(bean)
            result = general_message(200, "success", "操作成功", list=service_access_list)
        except Exception as e:
            logger.exception(e)
            result = error_message(e.message)
        return Response(result, status=result["code"])
Example #2
0
 def get(self, request, *args, **kwargs):
     """
     获取组件访问信息
     ---
     parameters:
         - name: tenantName
           description: 租户名
           required: true
           type: string
           paramType: path
         - name: serviceAlias
           description: 组件别名
           required: true
           type: string
           paramType: path
     """
     bean = dict()
     access_type, data = port_service.get_access_info(self.tenant, self.service)
     bean["access_type"] = access_type
     bean["access_info"] = data
     result = general_message(200, "success", "操作成功", bean=bean)
     return Response(result, status=result["code"])