@Override
    public void getConfig(CloudDataPlaneFilterConfig.Builder builder) {
        if (clientsLegacyMode) {
            builder.legacyMode(true);
        } else {
            var clientsCfg = clients.stream()
                    .filter(c -> !c.certificates().isEmpty())
                    .map(x -> new CloudDataPlaneFilterConfig.Clients.Builder()
                            .id(x.id())
                            .certificates(x.certificates().stream().map(X509CertificateUtils::toPem).toList())
                            .permissions(x.permissions().stream().map(Client.Permission::asString).sorted().toList()))
                    .toList();
            builder.clients(clientsCfg).legacyMode(false);
        }
    }
@Test
    public void it_generates_correct_legacy_config() throws IOException {
        Path certFile = securityFolder.resolve("clients.pem");
        Element clusterElem = DomBuilderTest.parse("<container version='1.0' />");
        X509Certificate certificate = createCertificate(certFile);

        buildModel(clusterElem);

        CloudDataPlaneFilterConfig config = root.getConfig(CloudDataPlaneFilterConfig.class, cloudDataPlaneFilterConfigId);
        assertTrue(config.legacyMode());
        List<CloudDataPlaneFilterConfig.Clients> clients = config.clients();
        assertEquals(0, clients.size());

        ConnectorConfig connectorConfig = connectorConfig();
        var caCerts = X509CertificateUtils.certificateListFromPem(connectorConfig.ssl().caCertificate());
        assertEquals(1, caCerts.size());
        assertEquals(List.of(certificate), caCerts);
    }