def get(self, request, enterprise_id, *args, **kwargs): region_status = request.GET.get("status", "") check_status = request.GET.get("check_status", "") data = region_services.get_enterprise_regions( enterprise_id, level="safe", status=region_status, check_status=check_status) result = general_message(200, "success", "获取成功", list=data) return Response(result, status=status.HTTP_200_OK)
def select_handle_region(self, eid): data = region_services.get_enterprise_regions(eid, level="safe", status=1, check_status=True) if data: for region in data: if region["rbd_version"] != "": return region_services.get_region_by_region_id( data[0]["region_id"]) raise RegionNotFound("暂无可用的集群,应用导出功能不可用")
def get(self, req): regions = region_services.get_enterprise_regions(self.enterprise.enterprise_id, level="") serializer = RegionInfoRespSerializer(data=regions, many=True) serializer.is_valid(raise_exception=True) return Response(serializer.data)