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

Update missing XML fields in AndOperator, Expiration and RuleFilter #1613

Merged
merged 5 commits into from
Jan 16, 2025
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
33 changes: 33 additions & 0 deletions api/src/main/java/io/minio/messages/AndOperator.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public class AndOperator {
@Convert(PrefixConverter.class)
private String prefix;

@Element(name = "ObjectSizeLessThan", required = false)
private Integer objectSizeLessThan;

@Element(name = "ObjectSizeGreaterThan", required = false)
private Integer objectSizeGreaterThan;

@ElementMap(
attribute = false,
entry = "Tag",
Expand Down Expand Up @@ -67,10 +73,37 @@ public AndOperator(
this.tags = (tags != null) ? Collections.unmodifiableMap(tags) : null;
}

public AndOperator(
dormanze marked this conversation as resolved.
Show resolved Hide resolved
@Nullable @Element(name = "Prefix", required = false) String prefix,
@Nullable
@ElementMap(
attribute = false,
entry = "Tag",
inline = true,
key = "Key",
value = "Value",
required = false)
Map<String, String> tags,
@Nullable @Element(name = "ObjectSizeLessThan", required = false) Integer objectSizeLessThan,
@Nullable @Element(name = "ObjectSizeGreaterThan", required = false)
Integer objectSizeGreaterThan) {
this(prefix, tags);
this.objectSizeLessThan = objectSizeLessThan;
this.objectSizeGreaterThan = objectSizeGreaterThan;
}

public String prefix() {
return this.prefix;
}

public Integer objectSizeLessThan() {
return this.objectSizeLessThan;
}

public Integer objectSizeGreaterThan() {
return this.objectSizeGreaterThan;
}

public Map<String, String> tags() {
return this.tags;
}
Expand Down
19 changes: 19 additions & 0 deletions api/src/main/java/io/minio/messages/Expiration.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public class Expiration extends DateDays {
@Element(name = "ExpiredObjectDeleteMarker", required = false)
private Boolean expiredObjectDeleteMarker;

@Element(name = "ExpiredObjectAllVersions", required = false)
private Boolean expiredObjectAllVersions;

public Expiration(
@Nullable @Element(name = "Date", required = false) ResponseDate date,
@Nullable @Element(name = "Days", required = false) Integer days,
Expand All @@ -51,7 +54,23 @@ public Expiration(ZonedDateTime date, Integer days, Boolean expiredObjectDeleteM
this(date == null ? null : new ResponseDate(date), days, expiredObjectDeleteMarker);
}

public Expiration(
dormanze marked this conversation as resolved.
Show resolved Hide resolved
@Nullable @Element(name = "Date", required = false) ResponseDate date,
@Nullable @Element(name = "Days", required = false) Integer days,
@Nullable @Element(name = "ExpiredObjectDeleteMarker", required = false)
Boolean expiredObjectDeleteMarker,
@Element(name = "ExpiredObjectAllVersions", required = false)
Boolean expiredObjectAllVersions) {
this(date, days, expiredObjectDeleteMarker);
this.expiredObjectAllVersions = expiredObjectAllVersions;
}

public Boolean expiredObjectDeleteMarker() {
return expiredObjectDeleteMarker;
}

/** This is MinIO specific extension. */
public Boolean expiredObjectAllVersions() {
dormanze marked this conversation as resolved.
Show resolved Hide resolved
return expiredObjectAllVersions;
}
}
26 changes: 26 additions & 0 deletions api/src/main/java/io/minio/messages/RuleFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public class RuleFilter {
@Element(name = "Tag", required = false)
private Tag tag;

@Element(name = "ObjectSizeLessThan", required = false)
private Integer objectSizeLessThan;

@Element(name = "ObjectSizeGreaterThan", required = false)
private Integer objectSizeGreaterThan;

public RuleFilter(
@Nullable @Element(name = "And", required = false) AndOperator andOperator,
@Nullable @Element(name = "Prefix", required = false) String prefix,
Expand All @@ -51,6 +57,18 @@ public RuleFilter(
}
}

public RuleFilter(
@Nullable @Element(name = "And", required = false) AndOperator andOperator,
@Nullable @Element(name = "Prefix", required = false) String prefix,
@Nullable @Element(name = "Tag", required = false) Tag tag,
@Nullable @Element(name = "ObjectSizeLessThan", required = false) Integer objectSizeLessThan,
@Nullable @Element(name = "ObjectSizeGreaterThan", required = false)
Integer objectSizeGreaterThan) {
this(andOperator, prefix, tag);
this.objectSizeLessThan = objectSizeLessThan;
this.objectSizeGreaterThan = objectSizeGreaterThan;
}

public RuleFilter(@Nonnull AndOperator andOperator) {
this.andOperator = Objects.requireNonNull(andOperator, "And operator must not be null");
}
Expand All @@ -74,4 +92,12 @@ public String prefix() {
public Tag tag() {
return this.tag;
}

public Integer objectSizeLessThan() {
return this.objectSizeLessThan;
}

public Integer objectSizeGreaterThan() {
return this.objectSizeGreaterThan;
}
}
Loading