Skip to content

Commit

Permalink
Rename s3 sink object metadata config options
Browse files Browse the repository at this point in the history
Signed-off-by: Kondaka <[email protected]>
  • Loading branch information
kkondaka committed Oct 10, 2024
1 parent db9a849 commit 8801b7d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
package org.opensearch.dataprepper.plugins.sink.s3;

import com.fasterxml.jackson.annotation.JsonProperty;
public class PredefinedObjectMetadata {
@JsonProperty("number_of_objects")
private String numberOfObjects;
public class ObjectMetadata {
@JsonProperty("number_of_events_key")
private String numberOfEventsKey;

public String getNumberOfObjects() {
return numberOfObjects;
public String getNumberOfEventsKey() {
return numberOfEventsKey;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public class S3SinkConfig {
@JsonProperty("bucket_selector")
private PluginModel bucketSelector;

@JsonProperty("predefined_object_metadata")
private PredefinedObjectMetadata predefinedObjectMetadata;
@JsonProperty("object_metadata")
private ObjectMetadata objectMetadata;

@AssertTrue(message = "You may not use both bucket and bucket_selector together in one S3 sink.")
private boolean isValidBucketConfig() {
Expand Down Expand Up @@ -142,8 +142,8 @@ public ObjectKeyOptions getObjectKeyOptions() {
return objectKeyOptions;
}

public PredefinedObjectMetadata getPredefinedObjectMetadata() {
return predefinedObjectMetadata;
public ObjectMetadata getObjectMetadata() {
return objectMetadata;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@

package org.opensearch.dataprepper.plugins.sink.s3.grouping;

import org.opensearch.dataprepper.plugins.sink.s3.PredefinedObjectMetadata;
import org.opensearch.dataprepper.plugins.sink.s3.ObjectMetadata;
import java.util.Map;
import java.util.Objects;

class S3GroupIdentifier {
private final Map<String, Object> groupIdentifierHash;
private final String groupIdentifierFullObjectKey;

private final PredefinedObjectMetadata predefinedObjectMetadata;
private final ObjectMetadata objectMetadata;
private final String fullBucketName;

public S3GroupIdentifier(final Map<String, Object> groupIdentifierHash,
final String groupIdentifierFullObjectKey,
final PredefinedObjectMetadata predefineObjectMetadata,
final ObjectMetadata objectMetadata,
final String fullBucketName) {
this.groupIdentifierHash = groupIdentifierHash;
this.groupIdentifierFullObjectKey = groupIdentifierFullObjectKey;
this.predefinedObjectMetadata = predefineObjectMetadata;
this.objectMetadata = objectMetadata;
this.fullBucketName = fullBucketName;
}

Expand All @@ -43,6 +43,6 @@ public int hashCode() {

public Map<String, Object> getGroupIdentifierHash() { return groupIdentifierHash; }

public Map<String, String> getMetadata(int eventCount) { return predefinedObjectMetadata != null ? Map.of(predefinedObjectMetadata.getNumberOfObjects(), Integer.toString(eventCount)) : null; }
public Map<String, String> getMetadata(int eventCount) { return objectMetadata != null ? Map.of(objectMetadata.getNumberOfEventsKey(), Integer.toString(eventCount)) : null; }
public String getFullBucketName() { return fullBucketName; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ public S3GroupIdentifier getS3GroupIdentifierForEvent(final Event event) {
}


return new S3GroupIdentifier(groupIdentificationHash, fullObjectKey, s3SinkConfig.getPredefinedObjectMetadata(), fullBucketName);
return new S3GroupIdentifier(groupIdentificationHash, fullObjectKey, s3SinkConfig.getObjectMetadata(), fullBucketName);
}
}

0 comments on commit 8801b7d

Please sign in to comment.