com.ionoscloud.s3.messages.Retention 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.time.ZonedDateTime;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Namespace;
import org.simpleframework.xml.Root;
/**
* Object representation of request XML of PutObjectRetention
* API and response XML of GetObjectRetention
* API.
*/
@Root(name = "Retention", strict = false)
@Namespace(reference = "http://s3.amazonaws.com/doc/2006-03-01/")
public class Retention {
@Element(name = "Mode", required = false)
private RetentionMode mode;
@Element(name = "RetainUntilDate", required = false)
private ResponseDate retainUntilDate;
public Retention() {}
/** Constructs a new Retention object with given retention until date and mode. */
public Retention(RetentionMode mode, ZonedDateTime retainUntilDate) {
if (mode == null) {
throw new IllegalArgumentException("null mode is not allowed");
}
if (retainUntilDate == null) {
throw new IllegalArgumentException("null retainUntilDate is not allowed");
}
this.mode = mode;
this.retainUntilDate = new ResponseDate(retainUntilDate);
}
/** Returns mode. */
public RetentionMode mode() {
return this.mode;
}
/** Returns retain until date. */
public ZonedDateTime retainUntilDate() {
if (retainUntilDate != null) {
return retainUntilDate.zonedDateTime();
}
return null;
}
}