-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'opensearch-project:main' into sqs-source-integration-tests
- Loading branch information
Showing
108 changed files
with
4,560 additions
and
990 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...ain/java/org/opensearch/dataprepper/model/event/exceptions/EventKeyNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.model.event.exceptions; | ||
|
||
public class EventKeyNotFoundException extends RuntimeException { | ||
public EventKeyNotFoundException(final String message) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
dependencies { | ||
implementation project(':data-prepper-api') | ||
implementation project(path: ':data-prepper-plugins:common') | ||
implementation 'io.micrometer:micrometer-core' | ||
implementation 'com.fasterxml.jackson.core:jackson-core' | ||
implementation 'com.fasterxml.jackson.core:jackson-databind' | ||
implementation 'org.apache.commons:commons-compress:1.21' | ||
|
||
implementation 'org.mapdb:mapdb:3.0.8' | ||
implementation 'commons-io:commons-io:2.12.0' | ||
implementation 'software.amazon.awssdk:aws-sdk-java:2.20.67' | ||
implementation 'software.amazon.awssdk:s3-transfer-manager' | ||
implementation 'software.amazon.awssdk.crt:aws-crt:0.21.17' | ||
implementation 'com.maxmind.geoip2:geoip2:4.0.1' | ||
implementation 'com.maxmind.db:maxmind-db:3.0.0' | ||
|
||
implementation 'org.apache.commons:commons-lang3:3.12.0' | ||
testImplementation project(':data-prepper-test-common') | ||
} | ||
|
||
|
||
test { | ||
useJUnitPlatform() | ||
} | ||
|
||
jacocoTestCoverageVerification { | ||
dependsOn jacocoTestReport | ||
violationRules { | ||
rule { | ||
limit { | ||
minimum = 1.0 | ||
} | ||
} | ||
} | ||
} | ||
|
||
check.dependsOn jacocoTestCoverageVerification | ||
|
||
sourceSets { | ||
integrationTest { | ||
java { | ||
compileClasspath += main.output + test.output | ||
runtimeClasspath += main.output + test.output | ||
srcDir file('src/integrationTest/java') | ||
} | ||
resources.srcDir file('src/integrationTest/resources') | ||
} | ||
} | ||
|
||
configurations { | ||
integrationTestImplementation.extendsFrom testImplementation | ||
integrationTestRuntime.extendsFrom testRuntime | ||
} | ||
|
||
task integrationTest(type: Test) { | ||
group = 'verification' | ||
testClassesDirs = sourceSets.integrationTest.output.classesDirs | ||
|
||
useJUnitPlatform() | ||
|
||
classpath = sourceSets.integrationTest.runtimeClasspath | ||
|
||
filter { | ||
includeTestsMatching '*IT' | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
...-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/GeoIPProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.plugins.processor; | ||
|
||
import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin; | ||
import org.opensearch.dataprepper.model.annotations.DataPrepperPluginConstructor; | ||
import org.opensearch.dataprepper.model.configuration.PluginSetting; | ||
import org.opensearch.dataprepper.model.event.Event; | ||
import org.opensearch.dataprepper.model.plugin.PluginFactory; | ||
import org.opensearch.dataprepper.model.processor.AbstractProcessor; | ||
import org.opensearch.dataprepper.model.processor.Processor; | ||
import org.opensearch.dataprepper.model.record.Record; | ||
import java.net.MalformedURLException; | ||
import java.util.Collection; | ||
|
||
/** | ||
* Implementation class of geoIP-processor plugin. It is responsible for enrichment of | ||
* attributes for the public IPs. Supports both IPV4 and IPV6 | ||
*/ | ||
@DataPrepperPlugin(name = "geoip", pluginType = Processor.class, pluginConfigurationType = GeoIPProcessorConfig.class) | ||
public class GeoIPProcessor extends AbstractProcessor<Record<Event>, Record<Event>> { | ||
|
||
/** | ||
* GeoIPProcessor constructor for initialization of required attributes | ||
* @param pluginSetting pluginSetting | ||
* @param geoCodingProcessorConfig geoCodingProcessorConfig | ||
* @param pluginFactory pluginFactory | ||
* @throws MalformedURLException MalformedURLException | ||
*/ | ||
@DataPrepperPluginConstructor | ||
public GeoIPProcessor(PluginSetting pluginSetting, | ||
final GeoIPProcessorConfig geoCodingProcessorConfig, | ||
final PluginFactory pluginFactory) throws MalformedURLException { | ||
super(pluginSetting); | ||
//TODO | ||
} | ||
|
||
/** | ||
* Get the enriched data from the maxmind database | ||
* @param records Input records | ||
* @return collection of record events | ||
*/ | ||
@Override | ||
public Collection<Record<Event>> doExecute(Collection<Record<Event>> records) { | ||
|
||
//TODO : logic call the enrichment of data class methods | ||
return null; | ||
} | ||
|
||
@Override | ||
public void prepareForShutdown() { | ||
//TODO | ||
} | ||
|
||
@Override | ||
public boolean isReadyForShutdown() { | ||
//TODO | ||
return false; | ||
} | ||
|
||
@Override | ||
public void shutdown() { | ||
//TODO | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...ssor/src/main/java/org/opensearch/dataprepper/plugins/processor/GeoIPProcessorConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.plugins.processor; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.NotNull; | ||
import org.opensearch.dataprepper.plugins.processor.configuration.KeysConfig; | ||
import org.opensearch.dataprepper.plugins.processor.configuration.ServiceTypeOptions; | ||
import org.opensearch.dataprepper.plugins.processor.configuration.AwsAuthenticationOptions; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* An implementation class of GeoIP Processor configuration | ||
*/ | ||
public class GeoIPProcessorConfig { | ||
|
||
@JsonProperty("aws") | ||
@NotNull | ||
@Valid | ||
private AwsAuthenticationOptions awsAuthenticationOptions; | ||
|
||
@JsonProperty("keys") | ||
@NotNull | ||
private List<KeysConfig> keysConfig; | ||
|
||
@JsonProperty("service_type") | ||
@NotNull | ||
private ServiceTypeOptions serviceType; | ||
|
||
/** | ||
* Aws Authentication configuration Options | ||
* @return AwsAuthenticationOptions | ||
*/ | ||
public AwsAuthenticationOptions getAwsAuthenticationOptions() { | ||
return awsAuthenticationOptions; | ||
} | ||
|
||
/** | ||
* Lists of Source, target and attributes | ||
* @return List of KeysConfig | ||
*/ | ||
public List<KeysConfig> getKeysConfig() { | ||
return keysConfig; | ||
} | ||
|
||
/** | ||
* Service type Options | ||
* @return ServiceTypeOptions | ||
*/ | ||
public ServiceTypeOptions getServiceType() { | ||
return serviceType; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...sor/src/main/java/org/opensearch/dataprepper/plugins/processor/GeoIPProcessorService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.plugins.processor; | ||
|
||
import org.opensearch.dataprepper.plugins.processor.databasedownload.DBSourceOptions; | ||
import java.net.InetAddress; | ||
import java.time.ZonedDateTime; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* Implementation class of geoIP-processor plugin service class. | ||
* It is responsible for calling of mmdb files download | ||
*/ | ||
public class GeoIPProcessorService { | ||
|
||
/** | ||
* GeoIPProcessorService constructor for initialization of required attributes | ||
* @param geoIPProcessorConfig geoIPProcessorConfig | ||
* @param tempPath tempPath | ||
*/ | ||
public GeoIPProcessorService(GeoIPProcessorConfig geoIPProcessorConfig, String tempPath) { | ||
//TODO | ||
} | ||
|
||
/** | ||
* Calling downlaod method abased on the database path type | ||
* @param DBSourceOptions DBSourceOptions | ||
*/ | ||
public void downloadThroughURLandS3(DBSourceOptions DBSourceOptions) { | ||
//TODO | ||
} | ||
|
||
/** | ||
* Method to call enrichment of data based on license type | ||
* @param inetAddress inetAddress | ||
* @param attributes attributes | ||
* @param pluginStartDateTime pluginStartDateTime | ||
* @return Enriched Map | ||
*/ | ||
public Map<String, Object> getGeoData(InetAddress inetAddress, List<String> attributes , ZonedDateTime pluginStartDateTime) { | ||
//TODO | ||
return null; | ||
} | ||
} |
Oops, something went wrong.