def METHOD_NAME(self, request, project_id, version_id, port_id):
    """检查指定的 port 是否被 service 关联"""
    ventity = self.get_versioned_entity(project_id, version_id)
    svc_id_list = ventity.get_resource_id_list(K8sResourceName.K8sService.value)
    svc_qsets = K8sService.objects.filter(id__in=svc_id_list)
    for svc in svc_qsets:
        ports = svc.get_ports_config()
        for p in ports:
            if str(p.get('id')) == str(port_id):
                raise error_codes.APIError(_("端口在 Service[{}] 中已经被关联,不能删除").format(svc.name))
    return Response({})