public void execute()

in src/main/java/co/elastic/support/diagnostics/commands/CheckKibanaVersion.java [41:86]


    public void execute(DiagnosticContext context) throws DiagnosticException {

        // Get the version number from the JSON returned
        // by just submitting the host/port combo
        logger.info(Constants.CONSOLE, "Getting Kibana Version.");

        try {
            RestClient restClient = RestClient.getClient(
                    context.diagnosticInputs.host,
                    context.diagnosticInputs.port,
                    context.diagnosticInputs.scheme,
                    context.diagnosticInputs.user,
                    context.diagnosticInputs.password,
                    context.diagnosticInputs.proxyHost,
                    context.diagnosticInputs.proxyPort,
                    context.diagnosticInputs.proxyUser,
                    context.diagnosticInputs.proxyPassword,
                    context.diagnosticInputs.pkiKeystore,
                    context.diagnosticInputs.pkiKeystorePass,
                    context.diagnosticInputs.skipVerification,
                    context.diagsConfig.extraHeaders,
                    context.diagsConfig.connectionTimeout,
                    context.diagsConfig.connectionRequestTimeout,
                    context.diagsConfig.socketTimeout);

            // Add it to the global cache - automatically closed on exit.
            context.resourceCache.addRestClient(Constants.restInputHost, restClient);
            context.version = getKibanaVersion(restClient);
            String version = context.version.getVersion();
            RestEntryConfig builder = new RestEntryConfig(version);
            Map restCalls = JsonYamlUtils.readYamlFromClasspath(Constants.KIBANA_REST, true);

            // logger.info(Constants.CONSOLE, restCalls);
            logger.info(Constants.CONSOLE, "Run basic queries for Kibana: {}", restCalls);

            context.elasticRestCalls = builder.buildEntryMap(restCalls);
            context.fullElasticRestCalls = context.elasticRestCalls;
        } catch (Exception e) {
            logger.error("Unanticipated error:", e);
            String errorLog = "Could't retrieve Kibana version due to a system or network error. %s%s%s";
            errorLog = String.format(errorLog, e.getMessage(),
                    SystemProperties.lineSeparator,
                    Constants.CHECK_LOG);
            throw new DiagnosticException(errorLog);
        }
    }