public Map<String, Object> getTelemetryResponse(User currentUser) {
        TelemetryUserSettings telemetryUserSettings = getTelemetryUserSettings(currentUser);
        if (isTelemetryEnabled && telemetryUserSettings.telemetryEnabled()) {
            DateTime clusterCreationDate = telemetryClusterService.getClusterCreationDate().orElse(null);
            String clusterId = telemetryClusterService.getClusterId();

            List<TelemetryLicenseStatus> licenseStatuses = enterpriseDataProvider.licenseStatus();
            return telemetryResponseFactory.createTelemetryResponse(
                    getClusterInfo(clusterId, clusterCreationDate, licenseStatuses),
                    getUserInfo(currentUser, clusterId),
                    getPluginInfo(),
                    getSearchClusterInfo(),
                    licenseStatuses,
                    telemetryUserSettings,
                    getDataNodeInfo());
        } else {
            return telemetryResponseFactory.createTelemetryDisabledResponse(telemetryUserSettings);
        }
    }
@Test
    void test_licenses() {
        TelemetryService telemetryService = createTelemetryService(true);
        mockUserTelemetryEnabled(true);
        mockTrafficData(trafficCounterService);
        TelemetryLicenseStatus enterpriseLicense = createLicense("/license/enterprise");
        TelemetryLicenseStatus expiredEnterpriseLicense = enterpriseLicense.toBuilder().expired(true).build();
        TelemetryLicenseStatus invalidEnterpriseLicense = enterpriseLicense.toBuilder().valid(false).build();
        TelemetryLicenseStatus olderEnterpriseLicense = enterpriseLicense.toBuilder()
                .expirationDate(enterpriseLicense.expirationDate().minusDays(1)).build();
        TelemetryLicenseStatus securityLicense = createLicense("/license/security");
        when(enterpriseDataProvider.licenseStatus()).thenReturn(List.of(
                olderEnterpriseLicense,
                invalidEnterpriseLicense,
                enterpriseLicense,
                expiredEnterpriseLicense,
                securityLicense));

        Map<String, Object> response = telemetryService.getTelemetryResponse(user);

        assertThat(response.get(LICENSE)).isEqualTo(merge(
                toMap(enterpriseLicense, "enterprise"),
                toMap(securityLicense, "security")));
    }