com.ionoscloud.s3.messages.ReplicationConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ionos-cloud-sdk-s3 Show documentation
Show all versions of ionos-cloud-sdk-s3 Show documentation
IONOS Java SDK for Amazon S3 Compatible Cloud Storage
The newest version!
package com.ionoscloud.s3.messages;
import java.util.Collections;
import java.util.LinkedList;
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;
import org.simpleframework.xml.Root;
/**
* Object representation of request XML of PutBucketReplication
* API and response XML of GetBucketReplication
* API.
*/
@Root(name = "ReplicationConfiguration")
@Namespace(reference = "http://s3.amazonaws.com/doc/2006-03-01/")
public class ReplicationConfiguration {
@Element(name = "Role", required = false)
private String role;
@ElementList(name = "Rule", inline = true)
private List rules;
/** Constructs new replication configuration. */
public ReplicationConfiguration(
@Nullable @Element(name = "Role", required = false) String role,
@Nonnull @ElementList(name = "Rule", inline = true) List rules) {
this.role = role;
this.rules =
Collections.unmodifiableList(Objects.requireNonNull(rules, "Rules must not be null"));
if (rules.isEmpty()) {
throw new IllegalArgumentException("Rules must not be empty");
}
if (rules.size() > 1000) {
throw new IllegalArgumentException("More than 1000 rules are not supported");
}
}
public String role() {
return role;
}
public List rules() {
return Collections.unmodifiableList(rules == null ? new LinkedList<>() : rules);
}
}