Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Mapping Model class and supporting Mapping framework #552

Merged
merged 2 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data-prepper-logstash-configuration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ repositories {

dependencies {
antlr "org.antlr:antlr4:4.9.2"
implementation project(':data-prepper-api')
testImplementation "org.hamcrest:hamcrest:2.2"
testImplementation "org.mockito:mockito-inline:${versionMap.mockito}"
testImplementation platform("org.junit:junit-bom:${versionMap.junitJupiter}")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.opensearch.dataprepper.logstash.mapping;

import java.util.Map;

/**
* Mapping Model class for Logstash plugins and attributes
*
* @since 1.2
*/
public class LogstashMappingModel {

private final String pluginName;
private final Map<String, Object> mappedAttributes;
private final Map<String, Object> additionalAttributes;

public LogstashMappingModel(final String pluginName, final Map<String, Object> mappedAttributes,
final Map<String, Object> additionalAttributes) {
this.pluginName = pluginName;
this.mappedAttributes = mappedAttributes;
this.additionalAttributes = additionalAttributes;
}

public String getPluginName() {
return pluginName;
}

public Map<String, Object> getMappedAttributes() {
return mappedAttributes;
}

public Map<String, Object> getAdditionalAttributes() {
return additionalAttributes;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.opensearch.dataprepper.logstash.mapping;

import com.amazon.dataprepper.model.configuration.PluginModel;
import org.opensearch.dataprepper.logstash.model.LogstashPlugin;

public interface LogstashPluginMapper {

/**
* Takes a Logstash plugin with its associated attributes and maps it to corresponding
* Data Prepper plugin and attributes based on Mapping files
*
* @param logstashPlugin A Logstash plugin with its attributes
* @return A Data Prepper plugin with its attributes
*/
PluginModel mapPlugin(LogstashPlugin logstashPlugin);
}