Skip to content

Commit

Permalink
Make Role optional in ReplicationConfiguration
Browse files Browse the repository at this point in the history
Signed-off-by: Bala.FA <bala@minio.io>
  • Loading branch information
balamurugana committed Nov 29, 2021
1 parent b1bd8da commit 1f12fe0
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.List;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.Namespace;
Expand All @@ -36,21 +37,17 @@
@Root(name = "ReplicationConfiguration")
@Namespace(reference = "http://s3.amazonaws.com/doc/2006-03-01/")
public class ReplicationConfiguration {
@Element(name = "Role")
@Element(name = "Role", required = false)
private String role;

@ElementList(name = "Rule", inline = true)
private List<ReplicationRule> rules;

/** Constructs new replication configuration. */
public ReplicationConfiguration(
@Nonnull @Element(name = "Role") String role,
@Nullable @Element(name = "Role", required = false) String role,
@Nonnull @ElementList(name = "Rule", inline = true) List<ReplicationRule> rules) {

this.role = Objects.requireNonNull(role, "Role must not be null");
if (role.isEmpty()) {
throw new IllegalArgumentException("Role must not be empty");
}
this.role = role; // Role is not applicable in MinIO server and it is optional.

this.rules =
Collections.unmodifiableList(Objects.requireNonNull(rules, "Rules must not be null"));
Expand Down

0 comments on commit 1f12fe0

Please sign in to comment.