Skip to content

Commit

Permalink
Incorporated review comments changes for opensearch-project#1985,open…
Browse files Browse the repository at this point in the history
…search-project#2264. Signed-off-by: rajeshLovesToCode <[email protected]>

Signed-off-by: rajeshLovesToCode <[email protected]>
  • Loading branch information
rajeshLovesToCode committed May 16, 2023
1 parent d92f4e9 commit d6fc13e
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 10 deletions.
1 change: 0 additions & 1 deletion data-prepper-plugins/opensearch-source/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dependencies {
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2'
implementation 'software.amazon.awssdk:s3'
implementation 'software.amazon.awssdk:sts'
implementation project(path: ':data-prepper-core')
testImplementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public AwsCredentialsProvider authenticateAwsConfiguration() {
.build();

AssumeRoleRequest.Builder assumeRoleRequestBuilder = AssumeRoleRequest.builder()
.roleSessionName("S3-Source-" + UUID.randomUUID())
.roleSessionName("OpenSearch-Source-" + UUID.randomUUID())
.roleArn(awsStsRoleArn);
if(awsStsHeaderOverrides != null && !awsStsHeaderOverrides.isEmpty()) {
assumeRoleRequestBuilder = assumeRoleRequestBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import jakarta.validation.constraints.Min;
import org.opensearch.dataprepper.parser.DataPrepperDurationDeserializer;

import java.time.Duration;
import java.time.LocalDateTime;

public class SchedulingParameterConfiguration {

@JsonProperty("rate")
@JsonDeserialize(using = DataPrepperDurationDeserializer.class)
private Duration rate;

@Min(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import software.amazon.awssdk.regions.Region;

import java.nio.file.Path;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;

Expand Down Expand Up @@ -45,7 +44,6 @@ public void open_search_source_config_values_test() throws JsonProcessingExcepti
" region: \"us-east-1\"\n" +
" sts_role_arn: \"arn:aws:iam::123456789012:role/aos-role\"\n" +
"scheduling:\n" +
" rate: \"P2DT3H4M\"\n" +
" job_count: 3\n" +
" start_time: 2023-05-05T18:00:00\n" +
"query:\n" +
Expand All @@ -72,7 +70,6 @@ public void open_search_source_config_values_test() throws JsonProcessingExcepti
assertThat(searchConfiguration.getExpandWildcards(),equalTo(WildCardOptions.OPEN));
assertThat(searchConfiguration.getBatchSize(),equalTo(1000));
assertThat(sourceConfiguration.getQueryParameterConfiguration().getFields(),equalTo(List.of("test_variable : test_value")));
assertThat(schedulingParameterConfiguration.getRate(),equalTo(Duration.parse("P2DT3H4M")));
assertThat(schedulingParameterConfiguration.getJobCount(),equalTo(3));
assertThat(schedulingParameterConfiguration.getStartTime(),equalTo(LocalDateTime.parse("2023-05-05T18:00:00")));
assertThat(sourceConfiguration.getIndexParametersConfiguration().getInclude().get(0),equalTo("shakespeare"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
import org.junit.Test;

import java.time.Duration;
import java.time.LocalDateTime;

import static org.hamcrest.CoreMatchers.equalTo;
Expand All @@ -24,11 +23,9 @@ public class SchedulingParameterConfigurationTest {
public void scheduling_parameter_configuration_test() throws JsonProcessingException {

final String schedulingParameterYaml =
" rate: \"P2DT3H4M\"\n" +
" job_count: 3\n" +
" start_time: 2023-05-05T18:00:00\n";
final SchedulingParameterConfiguration schedulingParameterConfiguration = objectMapper.readValue(schedulingParameterYaml, SchedulingParameterConfiguration.class);
assertThat(schedulingParameterConfiguration.getRate(),equalTo(Duration.parse("P2DT3H4M")));
assertThat(schedulingParameterConfiguration.getJobCount(),equalTo(3));
assertThat(schedulingParameterConfiguration.getStartTime(),equalTo(LocalDateTime.parse("2023-05-05T18:00:00")));
}
Expand Down

0 comments on commit d6fc13e

Please sign in to comment.