-
Notifications
You must be signed in to change notification settings - Fork 194
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 feature-httpsink-skeleton
- Loading branch information
Showing
68 changed files
with
3,008 additions
and
490 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
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
39 changes: 39 additions & 0 deletions
39
data-prepper-api/src/main/java/org/opensearch/dataprepper/model/sink/SinkContext.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,39 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.model.sink; | ||
|
||
import java.util.Collection; | ||
|
||
/** | ||
* Data Prepper Sink Context class. This the class for keeping global | ||
* sink configuration as context so that individual sinks may use them. | ||
*/ | ||
public class SinkContext { | ||
private final String tagsTargetKey; | ||
private final Collection<String> routes; | ||
|
||
public SinkContext(final String tagsTargetKey, final Collection<String> routes) { | ||
this.tagsTargetKey = tagsTargetKey; | ||
this.routes = routes; | ||
} | ||
|
||
/** | ||
* returns the target key name for tags if configured for a given sink | ||
* @return tags target key | ||
*/ | ||
public String getTagsTargetKey() { | ||
return tagsTargetKey; | ||
} | ||
|
||
/** | ||
* returns routes if configured for a given sink | ||
* @return routes | ||
*/ | ||
public Collection<String> getRoutes() { | ||
return routes; | ||
} | ||
} | ||
|
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
33 changes: 33 additions & 0 deletions
33
data-prepper-api/src/test/java/org/opensearch/dataprepper/model/sink/SinkContextTest.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,33 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.model.sink; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import org.apache.commons.lang3.RandomStringUtils; | ||
|
||
|
||
|
||
public class SinkContextTest { | ||
private SinkContext sinkContext; | ||
|
||
@Test | ||
public void testSinkContextBasic() { | ||
final String testTagsTargetKey = RandomStringUtils.randomAlphabetic(6); | ||
final List<String> testRoutes = Collections.emptyList(); | ||
sinkContext = new SinkContext(testTagsTargetKey, testRoutes); | ||
assertThat(sinkContext.getTagsTargetKey(), equalTo(testTagsTargetKey)); | ||
assertThat(sinkContext.getRoutes(), equalTo(testRoutes)); | ||
|
||
} | ||
|
||
} | ||
|
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 |
---|---|---|
|
@@ -3,5 +3,6 @@ customSinkPlugin: | |
routes: | ||
- "routeA" | ||
- "routeB" | ||
tags_target_key: "tags" | ||
key1: "value1" | ||
key2: "value2" |
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
Oops, something went wrong.