|
21 | 21 | import java.util.List; |
22 | 22 | import java.util.Objects; |
23 | 23 | import javax.annotation.Nonnull; |
| 24 | +import javax.annotation.Nullable; |
24 | 25 | import org.simpleframework.xml.Element; |
25 | 26 | import org.simpleframework.xml.ElementList; |
26 | 27 | import org.simpleframework.xml.Namespace; |
|
36 | 37 | @Root(name = "ReplicationConfiguration") |
37 | 38 | @Namespace(reference = "http://s3.amazonaws.com/doc/2006-03-01/") |
38 | 39 | public class ReplicationConfiguration { |
39 | | - @Element(name = "Role") |
| 40 | + @Element(name = "Role", required = false) |
40 | 41 | private String role; |
41 | 42 |
|
42 | 43 | @ElementList(name = "Rule", inline = true) |
43 | 44 | private List<ReplicationRule> rules; |
44 | 45 |
|
45 | 46 | /** Constructs new replication configuration. */ |
46 | 47 | public ReplicationConfiguration( |
47 | | - @Nonnull @Element(name = "Role") String role, |
| 48 | + @Nullable @Element(name = "Role", required = false) String role, |
48 | 49 | @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. |
54 | 51 |
|
55 | 52 | this.rules = |
56 | 53 | Collections.unmodifiableList(Objects.requireNonNull(rules, "Rules must not be null")); |
|
0 commit comments