Skip to content

Commit fc717ac

Browse files
authored
Make Role optional in ReplicationConfiguration (#1268)
Signed-off-by: Bala.FA <[email protected]>
1 parent cadb74a commit fc717ac

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

api/src/main/java/io/minio/messages/ReplicationConfiguration.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.List;
2222
import java.util.Objects;
2323
import javax.annotation.Nonnull;
24+
import javax.annotation.Nullable;
2425
import org.simpleframework.xml.Element;
2526
import org.simpleframework.xml.ElementList;
2627
import org.simpleframework.xml.Namespace;
@@ -36,21 +37,17 @@
3637
@Root(name = "ReplicationConfiguration")
3738
@Namespace(reference = "http://s3.amazonaws.com/doc/2006-03-01/")
3839
public class ReplicationConfiguration {
39-
@Element(name = "Role")
40+
@Element(name = "Role", required = false)
4041
private String role;
4142

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

4546
/** Constructs new replication configuration. */
4647
public ReplicationConfiguration(
47-
@Nonnull @Element(name = "Role") String role,
48+
@Nullable @Element(name = "Role", required = false) String role,
4849
@Nonnull @ElementList(name = "Rule", inline = true) List<ReplicationRule> rules) {
49-
50-
this.role = Objects.requireNonNull(role, "Role must not be null");
51-
if (role.isEmpty()) {
52-
throw new IllegalArgumentException("Role must not be empty");
53-
}
50+
this.role = role; // Role is not applicable in MinIO server and it is optional.
5451

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

0 commit comments

Comments
 (0)