def post(self, request, team_id, app_id, *args, **kwargs): """ 应用复制 --- parameters: - name: tenantName description: 团队名称 required: true type: string paramType: path - name: app_id description: 应用id required: true type: int paramType: path """ serializers = AppCopyCSerializer(data=request.data) serializers.is_valid(raise_exception=True) services = serializers.data.get("services") tar_team_name = request.data.get("target_team_name") tar_region_name = request.data.get("target_region_name") tar_app_id = request.data.get("target_app_id") tar_team, tar_group = groupapp_copy_service.check_and_get_team_group(request.user, tar_team_name, tar_region_name, tar_app_id) services = groupapp_copy_service.copy_group_services(request.user, self.team, self.region_name, tar_team, tar_region_name, tar_group, app_id, services) services = ServiceBaseInfoSerializer(data=services, many=True) services.is_valid() serializers = AppCopyCResSerializer(data={"services": services.data}) serializers.is_valid() return Response(serializers.data, status=200)
def get(self, req, app_id, service_id, *args, **kwargs): status_list = base_service.status_multi_service( region=self.app.region_name, tenant_name=self.team.tenant_name, service_ids=[self.service.service_id], enterprise_id=self.team.enterprise_id) self.service.status = status_list[0]["status"] serializer = ServiceBaseInfoSerializer(data=self.service.to_dict()) serializer.is_valid() return Response(serializer.data, status=status.HTTP_200_OK)
def get(self, req, app_id, *args, **kwargs): services = app_service.get_app_services_and_status(self.app) serializer = ServiceBaseInfoSerializer(data=services, many=True) serializer.is_valid() return Response(serializer.data, status=status.HTTP_200_OK)