com.amazonaws.services.s3control.model.S3Retention Maven / Gradle / Ivy
Show all versions of aws-java-sdk-s3control Show documentation
/*
* Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.s3control.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* Contains the S3 Object Lock retention mode to be applied to all objects in the S3 Batch Operations job. If you don't
* provide Mode
and RetainUntilDate
data types in your operation, you will remove the
* retention from your objects. For more information, see Using S3 Object Lock retention
* with S3 Batch Operations in the Amazon S3 User Guide.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class S3Retention implements Serializable, Cloneable {
/**
*
* The date when the applied Object Lock retention will expire on all objects set by the Batch Operations job.
*
*/
private java.util.Date retainUntilDate;
/**
*
* The Object Lock retention mode to be applied to all objects in the Batch Operations job.
*
*/
private String mode;
/**
*
* The date when the applied Object Lock retention will expire on all objects set by the Batch Operations job.
*
*
* @param retainUntilDate
* The date when the applied Object Lock retention will expire on all objects set by the Batch Operations
* job.
*/
public void setRetainUntilDate(java.util.Date retainUntilDate) {
this.retainUntilDate = retainUntilDate;
}
/**
*
* The date when the applied Object Lock retention will expire on all objects set by the Batch Operations job.
*
*
* @return The date when the applied Object Lock retention will expire on all objects set by the Batch Operations
* job.
*/
public java.util.Date getRetainUntilDate() {
return this.retainUntilDate;
}
/**
*
* The date when the applied Object Lock retention will expire on all objects set by the Batch Operations job.
*
*
* @param retainUntilDate
* The date when the applied Object Lock retention will expire on all objects set by the Batch Operations
* job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Retention withRetainUntilDate(java.util.Date retainUntilDate) {
setRetainUntilDate(retainUntilDate);
return this;
}
/**
*
* The Object Lock retention mode to be applied to all objects in the Batch Operations job.
*
*
* @param mode
* The Object Lock retention mode to be applied to all objects in the Batch Operations job.
* @see S3ObjectLockRetentionMode
*/
public void setMode(String mode) {
this.mode = mode;
}
/**
*
* The Object Lock retention mode to be applied to all objects in the Batch Operations job.
*
*
* @return The Object Lock retention mode to be applied to all objects in the Batch Operations job.
* @see S3ObjectLockRetentionMode
*/
public String getMode() {
return this.mode;
}
/**
*
* The Object Lock retention mode to be applied to all objects in the Batch Operations job.
*
*
* @param mode
* The Object Lock retention mode to be applied to all objects in the Batch Operations job.
* @return Returns a reference to this object so that method calls can be chained together.
* @see S3ObjectLockRetentionMode
*/
public S3Retention withMode(String mode) {
setMode(mode);
return this;
}
/**
*
* The Object Lock retention mode to be applied to all objects in the Batch Operations job.
*
*
* @param mode
* The Object Lock retention mode to be applied to all objects in the Batch Operations job.
* @return Returns a reference to this object so that method calls can be chained together.
* @see S3ObjectLockRetentionMode
*/
public S3Retention withMode(S3ObjectLockRetentionMode mode) {
this.mode = mode.toString();
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getRetainUntilDate() != null)
sb.append("RetainUntilDate: ").append(getRetainUntilDate()).append(",");
if (getMode() != null)
sb.append("Mode: ").append(getMode());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof S3Retention == false)
return false;
S3Retention other = (S3Retention) obj;
if (other.getRetainUntilDate() == null ^ this.getRetainUntilDate() == null)
return false;
if (other.getRetainUntilDate() != null && other.getRetainUntilDate().equals(this.getRetainUntilDate()) == false)
return false;
if (other.getMode() == null ^ this.getMode() == null)
return false;
if (other.getMode() != null && other.getMode().equals(this.getMode()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getRetainUntilDate() == null) ? 0 : getRetainUntilDate().hashCode());
hashCode = prime * hashCode + ((getMode() == null) ? 0 : getMode().hashCode());
return hashCode;
}
@Override
public S3Retention clone() {
try {
return (S3Retention) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}