com.amazonaws.services.backup.model.LegalHold Maven / Gradle / Ivy
Show all versions of aws-java-sdk-backup 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.backup.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* A legal hold is an administrative tool that helps prevent backups from being deleted while under a hold. While the
* hold is in place, backups under a hold cannot be deleted and lifecycle policies that would alter the backup status
* (such as transition to cold storage) are delayed until the legal hold is removed. A backup can have more than one
* legal hold. Legal holds are applied to one or more backups (also known as recovery points). These backups can be
* filtered by resource types and by resource IDs.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class LegalHold implements Serializable, Cloneable, StructuredPojo {
/**
*
* This is the title of a legal hold.
*
*/
private String title;
/**
*
* This is the status of the legal hold. Statuses can be ACTIVE
, CREATING
,
* CANCELED
, and CANCELING
.
*
*/
private String status;
/**
*
* This is the description of a legal hold.
*
*/
private String description;
/**
*
* ID of specific legal hold on one or more recovery points.
*
*/
private String legalHoldId;
/**
*
* This is an Amazon Resource Number (ARN) that uniquely identifies the legal hold; for example,
* arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45
.
*
*/
private String legalHoldArn;
/**
*
* This is the time in number format when legal hold was created.
*
*/
private java.util.Date creationDate;
/**
*
* This is the time in number format when legal hold was cancelled.
*
*/
private java.util.Date cancellationDate;
/**
*
* This is the title of a legal hold.
*
*
* @param title
* This is the title of a legal hold.
*/
public void setTitle(String title) {
this.title = title;
}
/**
*
* This is the title of a legal hold.
*
*
* @return This is the title of a legal hold.
*/
public String getTitle() {
return this.title;
}
/**
*
* This is the title of a legal hold.
*
*
* @param title
* This is the title of a legal hold.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LegalHold withTitle(String title) {
setTitle(title);
return this;
}
/**
*
* This is the status of the legal hold. Statuses can be ACTIVE
, CREATING
,
* CANCELED
, and CANCELING
.
*
*
* @param status
* This is the status of the legal hold. Statuses can be ACTIVE
, CREATING
,
* CANCELED
, and CANCELING
.
* @see LegalHoldStatus
*/
public void setStatus(String status) {
this.status = status;
}
/**
*
* This is the status of the legal hold. Statuses can be ACTIVE
, CREATING
,
* CANCELED
, and CANCELING
.
*
*
* @return This is the status of the legal hold. Statuses can be ACTIVE
, CREATING
,
* CANCELED
, and CANCELING
.
* @see LegalHoldStatus
*/
public String getStatus() {
return this.status;
}
/**
*
* This is the status of the legal hold. Statuses can be ACTIVE
, CREATING
,
* CANCELED
, and CANCELING
.
*
*
* @param status
* This is the status of the legal hold. Statuses can be ACTIVE
, CREATING
,
* CANCELED
, and CANCELING
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see LegalHoldStatus
*/
public LegalHold withStatus(String status) {
setStatus(status);
return this;
}
/**
*
* This is the status of the legal hold. Statuses can be ACTIVE
, CREATING
,
* CANCELED
, and CANCELING
.
*
*
* @param status
* This is the status of the legal hold. Statuses can be ACTIVE
, CREATING
,
* CANCELED
, and CANCELING
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see LegalHoldStatus
*/
public LegalHold withStatus(LegalHoldStatus status) {
this.status = status.toString();
return this;
}
/**
*
* This is the description of a legal hold.
*
*
* @param description
* This is the description of a legal hold.
*/
public void setDescription(String description) {
this.description = description;
}
/**
*
* This is the description of a legal hold.
*
*
* @return This is the description of a legal hold.
*/
public String getDescription() {
return this.description;
}
/**
*
* This is the description of a legal hold.
*
*
* @param description
* This is the description of a legal hold.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LegalHold withDescription(String description) {
setDescription(description);
return this;
}
/**
*
* ID of specific legal hold on one or more recovery points.
*
*
* @param legalHoldId
* ID of specific legal hold on one or more recovery points.
*/
public void setLegalHoldId(String legalHoldId) {
this.legalHoldId = legalHoldId;
}
/**
*
* ID of specific legal hold on one or more recovery points.
*
*
* @return ID of specific legal hold on one or more recovery points.
*/
public String getLegalHoldId() {
return this.legalHoldId;
}
/**
*
* ID of specific legal hold on one or more recovery points.
*
*
* @param legalHoldId
* ID of specific legal hold on one or more recovery points.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LegalHold withLegalHoldId(String legalHoldId) {
setLegalHoldId(legalHoldId);
return this;
}
/**
*
* This is an Amazon Resource Number (ARN) that uniquely identifies the legal hold; for example,
* arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45
.
*
*
* @param legalHoldArn
* This is an Amazon Resource Number (ARN) that uniquely identifies the legal hold; for example,
* arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45
.
*/
public void setLegalHoldArn(String legalHoldArn) {
this.legalHoldArn = legalHoldArn;
}
/**
*
* This is an Amazon Resource Number (ARN) that uniquely identifies the legal hold; for example,
* arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45
.
*
*
* @return This is an Amazon Resource Number (ARN) that uniquely identifies the legal hold; for example,
* arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45
.
*/
public String getLegalHoldArn() {
return this.legalHoldArn;
}
/**
*
* This is an Amazon Resource Number (ARN) that uniquely identifies the legal hold; for example,
* arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45
.
*
*
* @param legalHoldArn
* This is an Amazon Resource Number (ARN) that uniquely identifies the legal hold; for example,
* arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LegalHold withLegalHoldArn(String legalHoldArn) {
setLegalHoldArn(legalHoldArn);
return this;
}
/**
*
* This is the time in number format when legal hold was created.
*
*
* @param creationDate
* This is the time in number format when legal hold was created.
*/
public void setCreationDate(java.util.Date creationDate) {
this.creationDate = creationDate;
}
/**
*
* This is the time in number format when legal hold was created.
*
*
* @return This is the time in number format when legal hold was created.
*/
public java.util.Date getCreationDate() {
return this.creationDate;
}
/**
*
* This is the time in number format when legal hold was created.
*
*
* @param creationDate
* This is the time in number format when legal hold was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LegalHold withCreationDate(java.util.Date creationDate) {
setCreationDate(creationDate);
return this;
}
/**
*
* This is the time in number format when legal hold was cancelled.
*
*
* @param cancellationDate
* This is the time in number format when legal hold was cancelled.
*/
public void setCancellationDate(java.util.Date cancellationDate) {
this.cancellationDate = cancellationDate;
}
/**
*
* This is the time in number format when legal hold was cancelled.
*
*
* @return This is the time in number format when legal hold was cancelled.
*/
public java.util.Date getCancellationDate() {
return this.cancellationDate;
}
/**
*
* This is the time in number format when legal hold was cancelled.
*
*
* @param cancellationDate
* This is the time in number format when legal hold was cancelled.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LegalHold withCancellationDate(java.util.Date cancellationDate) {
setCancellationDate(cancellationDate);
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 (getTitle() != null)
sb.append("Title: ").append(getTitle()).append(",");
if (getStatus() != null)
sb.append("Status: ").append(getStatus()).append(",");
if (getDescription() != null)
sb.append("Description: ").append(getDescription()).append(",");
if (getLegalHoldId() != null)
sb.append("LegalHoldId: ").append(getLegalHoldId()).append(",");
if (getLegalHoldArn() != null)
sb.append("LegalHoldArn: ").append(getLegalHoldArn()).append(",");
if (getCreationDate() != null)
sb.append("CreationDate: ").append(getCreationDate()).append(",");
if (getCancellationDate() != null)
sb.append("CancellationDate: ").append(getCancellationDate());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof LegalHold == false)
return false;
LegalHold other = (LegalHold) obj;
if (other.getTitle() == null ^ this.getTitle() == null)
return false;
if (other.getTitle() != null && other.getTitle().equals(this.getTitle()) == false)
return false;
if (other.getStatus() == null ^ this.getStatus() == null)
return false;
if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
return false;
if (other.getDescription() == null ^ this.getDescription() == null)
return false;
if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false)
return false;
if (other.getLegalHoldId() == null ^ this.getLegalHoldId() == null)
return false;
if (other.getLegalHoldId() != null && other.getLegalHoldId().equals(this.getLegalHoldId()) == false)
return false;
if (other.getLegalHoldArn() == null ^ this.getLegalHoldArn() == null)
return false;
if (other.getLegalHoldArn() != null && other.getLegalHoldArn().equals(this.getLegalHoldArn()) == false)
return false;
if (other.getCreationDate() == null ^ this.getCreationDate() == null)
return false;
if (other.getCreationDate() != null && other.getCreationDate().equals(this.getCreationDate()) == false)
return false;
if (other.getCancellationDate() == null ^ this.getCancellationDate() == null)
return false;
if (other.getCancellationDate() != null && other.getCancellationDate().equals(this.getCancellationDate()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getTitle() == null) ? 0 : getTitle().hashCode());
hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode());
hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode());
hashCode = prime * hashCode + ((getLegalHoldId() == null) ? 0 : getLegalHoldId().hashCode());
hashCode = prime * hashCode + ((getLegalHoldArn() == null) ? 0 : getLegalHoldArn().hashCode());
hashCode = prime * hashCode + ((getCreationDate() == null) ? 0 : getCreationDate().hashCode());
hashCode = prime * hashCode + ((getCancellationDate() == null) ? 0 : getCancellationDate().hashCode());
return hashCode;
}
@Override
public LegalHold clone() {
try {
return (LegalHold) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.backup.model.transform.LegalHoldMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}