Search in sources :

Example 1 with OpenSearchSourceConfigurationField

use of org.codice.ddf.admin.sources.fields.type.OpenSearchSourceConfigurationField in project admin-console-beta by connexta.

the class OpenSearchServiceProperties method servicePropsToOpenSearchConfig.

public static final OpenSearchSourceConfigurationField servicePropsToOpenSearchConfig(Map<String, Object> props) {
    OpenSearchSourceConfigurationField config = new OpenSearchSourceConfigurationField();
    config.pid(mapValue(props, SERVICE_PID_KEY));
    config.sourceName(mapValue(props, SHORTNAME));
    config.endpointUrl(mapValue(props, ENDPOINT_URL));
    config.credentials().username(mapValue(props, USERNAME));
    config.credentials().password(FLAG_PASSWORD);
    return config;
}
Also used : OpenSearchSourceConfigurationField(org.codice.ddf.admin.sources.fields.type.OpenSearchSourceConfigurationField)

Example 2 with OpenSearchSourceConfigurationField

use of org.codice.ddf.admin.sources.fields.type.OpenSearchSourceConfigurationField in project admin-console-beta by connexta.

the class OpenSearchSourceUtils method getOpenSearchConfig.

/**
     * Attempts to create an OpenSearch configuration with the provided URL and credentials. If a configuration
     * is not found or created, the {@link ReportWithResultImpl}'s will have errors.
     *
     * @param urlField The URL to probe for OpenSearch capabilities
     * @param creds    optional credentials to send with Basic Auth header
     * @return a {@link ReportWithResultImpl} containing the {@link SourceConfigUnionField} or containing {@link org.codice.ddf.admin.common.report.message.ErrorMessage}s on failure.
     */
public ReportWithResultImpl<SourceConfigUnionField> getOpenSearchConfig(UrlField urlField, CredentialsField creds) {
    ReportWithResultImpl<SourceConfigUnionField> configResult = new ReportWithResultImpl<>();
    configResult.addMessages(verifyOpenSearchCapabilities(urlField, creds));
    if (configResult.containsErrorMsgs()) {
        return configResult;
    }
    OpenSearchSourceConfigurationField config = new OpenSearchSourceConfigurationField();
    config.endpointUrl(urlField.getValue()).credentials().username(creds.username()).password(FLAG_PASSWORD);
    configResult.result(config);
    return configResult;
}
Also used : ReportWithResultImpl(org.codice.ddf.admin.common.report.ReportWithResultImpl) OpenSearchSourceConfigurationField(org.codice.ddf.admin.sources.fields.type.OpenSearchSourceConfigurationField) SourceConfigUnionField(org.codice.ddf.admin.sources.fields.type.SourceConfigUnionField)

Aggregations

OpenSearchSourceConfigurationField (org.codice.ddf.admin.sources.fields.type.OpenSearchSourceConfigurationField)2 ReportWithResultImpl (org.codice.ddf.admin.common.report.ReportWithResultImpl)1 SourceConfigUnionField (org.codice.ddf.admin.sources.fields.type.SourceConfigUnionField)1