/* * Copyright 2018-2023 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.cloudhsmv2.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Contains information about a backup of an AWS CloudHSM cluster. All backup objects contain the BackupId, * BackupState, ClusterId, and CreateTimestamp parameters. Backups that were * copied into a destination region additionally contain the CopyTimestamp, SourceBackup, * SourceCluster, and SourceRegion parameters. A backup that is pending deletion will include * the DeleteTimestamp parameter. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Backup implements Serializable, Cloneable, StructuredPojo { /** *

* The identifier (ID) of the backup. *

*/ private String backupId; /** *

* The state of the backup. *

*/ private String backupState; /** *

* The identifier (ID) of the cluster that was backed up. *

*/ private String clusterId; /** *

* The date and time when the backup was created. *

*/ private java.util.Date createTimestamp; /** *

* The date and time when the backup was copied from a source backup. *

*/ private java.util.Date copyTimestamp; /** *

* Specifies whether the service should exempt a backup from the retention policy for the cluster. True * exempts a backup from the retention policy. False means the service applies the backup retention * policy defined at the cluster. *

*/ private Boolean neverExpires; /** *

* The AWS Region that contains the source backup from which the new backup was copied. *

*/ private String sourceRegion; /** *

* The identifier (ID) of the source backup from which the new backup was copied. *

*/ private String sourceBackup; /** *

* The identifier (ID) of the cluster containing the source backup from which the new backup was copied. *

*/ private String sourceCluster; /** *

* The date and time when the backup will be permanently deleted. *

*/ private java.util.Date deleteTimestamp; /** *

* The list of tags for the backup. *

*/ private java.util.List tagList; /** *

* The identifier (ID) of the backup. *

* * @param backupId * The identifier (ID) of the backup. */ public void setBackupId(String backupId) { this.backupId = backupId; } /** *

* The identifier (ID) of the backup. *

* * @return The identifier (ID) of the backup. */ public String getBackupId() { return this.backupId; } /** *

* The identifier (ID) of the backup. *

* * @param backupId * The identifier (ID) of the backup. * @return Returns a reference to this object so that method calls can be chained together. */ public Backup withBackupId(String backupId) { setBackupId(backupId); return this; } /** *

* The state of the backup. *

* * @param backupState * The state of the backup. * @see BackupState */ public void setBackupState(String backupState) { this.backupState = backupState; } /** *

* The state of the backup. *

* * @return The state of the backup. * @see BackupState */ public String getBackupState() { return this.backupState; } /** *

* The state of the backup. *

* * @param backupState * The state of the backup. * @return Returns a reference to this object so that method calls can be chained together. * @see BackupState */ public Backup withBackupState(String backupState) { setBackupState(backupState); return this; } /** *

* The state of the backup. *

* * @param backupState * The state of the backup. * @return Returns a reference to this object so that method calls can be chained together. * @see BackupState */ public Backup withBackupState(BackupState backupState) { this.backupState = backupState.toString(); return this; } /** *

* The identifier (ID) of the cluster that was backed up. *

* * @param clusterId * The identifier (ID) of the cluster that was backed up. */ public void setClusterId(String clusterId) { this.clusterId = clusterId; } /** *

* The identifier (ID) of the cluster that was backed up. *

* * @return The identifier (ID) of the cluster that was backed up. */ public String getClusterId() { return this.clusterId; } /** *

* The identifier (ID) of the cluster that was backed up. *

* * @param clusterId * The identifier (ID) of the cluster that was backed up. * @return Returns a reference to this object so that method calls can be chained together. */ public Backup withClusterId(String clusterId) { setClusterId(clusterId); return this; } /** *

* The date and time when the backup was created. *

* * @param createTimestamp * The date and time when the backup was created. */ public void setCreateTimestamp(java.util.Date createTimestamp) { this.createTimestamp = createTimestamp; } /** *

* The date and time when the backup was created. *

* * @return The date and time when the backup was created. */ public java.util.Date getCreateTimestamp() { return this.createTimestamp; } /** *

* The date and time when the backup was created. *

* * @param createTimestamp * The date and time when the backup was created. * @return Returns a reference to this object so that method calls can be chained together. */ public Backup withCreateTimestamp(java.util.Date createTimestamp) { setCreateTimestamp(createTimestamp); return this; } /** *

* The date and time when the backup was copied from a source backup. *

* * @param copyTimestamp * The date and time when the backup was copied from a source backup. */ public void setCopyTimestamp(java.util.Date copyTimestamp) { this.copyTimestamp = copyTimestamp; } /** *

* The date and time when the backup was copied from a source backup. *

* * @return The date and time when the backup was copied from a source backup. */ public java.util.Date getCopyTimestamp() { return this.copyTimestamp; } /** *

* The date and time when the backup was copied from a source backup. *

* * @param copyTimestamp * The date and time when the backup was copied from a source backup. * @return Returns a reference to this object so that method calls can be chained together. */ public Backup withCopyTimestamp(java.util.Date copyTimestamp) { setCopyTimestamp(copyTimestamp); return this; } /** *

* Specifies whether the service should exempt a backup from the retention policy for the cluster. True * exempts a backup from the retention policy. False means the service applies the backup retention * policy defined at the cluster. *

* * @param neverExpires * Specifies whether the service should exempt a backup from the retention policy for the cluster. * True exempts a backup from the retention policy. False means the service applies * the backup retention policy defined at the cluster. */ public void setNeverExpires(Boolean neverExpires) { this.neverExpires = neverExpires; } /** *

* Specifies whether the service should exempt a backup from the retention policy for the cluster. True * exempts a backup from the retention policy. False means the service applies the backup retention * policy defined at the cluster. *

* * @return Specifies whether the service should exempt a backup from the retention policy for the cluster. * True exempts a backup from the retention policy. False means the service * applies the backup retention policy defined at the cluster. */ public Boolean getNeverExpires() { return this.neverExpires; } /** *

* Specifies whether the service should exempt a backup from the retention policy for the cluster. True * exempts a backup from the retention policy. False means the service applies the backup retention * policy defined at the cluster. *

* * @param neverExpires * Specifies whether the service should exempt a backup from the retention policy for the cluster. * True exempts a backup from the retention policy. False means the service applies * the backup retention policy defined at the cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public Backup withNeverExpires(Boolean neverExpires) { setNeverExpires(neverExpires); return this; } /** *

* Specifies whether the service should exempt a backup from the retention policy for the cluster. True * exempts a backup from the retention policy. False means the service applies the backup retention * policy defined at the cluster. *

* * @return Specifies whether the service should exempt a backup from the retention policy for the cluster. * True exempts a backup from the retention policy. False means the service * applies the backup retention policy defined at the cluster. */ public Boolean isNeverExpires() { return this.neverExpires; } /** *

* The AWS Region that contains the source backup from which the new backup was copied. *

* * @param sourceRegion * The AWS Region that contains the source backup from which the new backup was copied. */ public void setSourceRegion(String sourceRegion) { this.sourceRegion = sourceRegion; } /** *

* The AWS Region that contains the source backup from which the new backup was copied. *

* * @return The AWS Region that contains the source backup from which the new backup was copied. */ public String getSourceRegion() { return this.sourceRegion; } /** *

* The AWS Region that contains the source backup from which the new backup was copied. *

* * @param sourceRegion * The AWS Region that contains the source backup from which the new backup was copied. * @return Returns a reference to this object so that method calls can be chained together. */ public Backup withSourceRegion(String sourceRegion) { setSourceRegion(sourceRegion); return this; } /** *

* The identifier (ID) of the source backup from which the new backup was copied. *

* * @param sourceBackup * The identifier (ID) of the source backup from which the new backup was copied. */ public void setSourceBackup(String sourceBackup) { this.sourceBackup = sourceBackup; } /** *

* The identifier (ID) of the source backup from which the new backup was copied. *

* * @return The identifier (ID) of the source backup from which the new backup was copied. */ public String getSourceBackup() { return this.sourceBackup; } /** *

* The identifier (ID) of the source backup from which the new backup was copied. *

* * @param sourceBackup * The identifier (ID) of the source backup from which the new backup was copied. * @return Returns a reference to this object so that method calls can be chained together. */ public Backup withSourceBackup(String sourceBackup) { setSourceBackup(sourceBackup); return this; } /** *

* The identifier (ID) of the cluster containing the source backup from which the new backup was copied. *

* * @param sourceCluster * The identifier (ID) of the cluster containing the source backup from which the new backup was copied. */ public void setSourceCluster(String sourceCluster) { this.sourceCluster = sourceCluster; } /** *

* The identifier (ID) of the cluster containing the source backup from which the new backup was copied. *

* * @return The identifier (ID) of the cluster containing the source backup from which the new backup was copied. */ public String getSourceCluster() { return this.sourceCluster; } /** *

* The identifier (ID) of the cluster containing the source backup from which the new backup was copied. *

* * @param sourceCluster * The identifier (ID) of the cluster containing the source backup from which the new backup was copied. * @return Returns a reference to this object so that method calls can be chained together. */ public Backup withSourceCluster(String sourceCluster) { setSourceCluster(sourceCluster); return this; } /** *

* The date and time when the backup will be permanently deleted. *

* * @param deleteTimestamp * The date and time when the backup will be permanently deleted. */ public void setDeleteTimestamp(java.util.Date deleteTimestamp) { this.deleteTimestamp = deleteTimestamp; } /** *

* The date and time when the backup will be permanently deleted. *

* * @return The date and time when the backup will be permanently deleted. */ public java.util.Date getDeleteTimestamp() { return this.deleteTimestamp; } /** *

* The date and time when the backup will be permanently deleted. *

* * @param deleteTimestamp * The date and time when the backup will be permanently deleted. * @return Returns a reference to this object so that method calls can be chained together. */ public Backup withDeleteTimestamp(java.util.Date deleteTimestamp) { setDeleteTimestamp(deleteTimestamp); return this; } /** *

* The list of tags for the backup. *

* * @return The list of tags for the backup. */ public java.util.List getTagList() { return tagList; } /** *

* The list of tags for the backup. *

* * @param tagList * The list of tags for the backup. */ public void setTagList(java.util.Collection tagList) { if (tagList == null) { this.tagList = null; return; } this.tagList = new java.util.ArrayList(tagList); } /** *

* The list of tags for the backup. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setTagList(java.util.Collection)} or {@link #withTagList(java.util.Collection)} if you want to override * the existing values. *

* * @param tagList * The list of tags for the backup. * @return Returns a reference to this object so that method calls can be chained together. */ public Backup withTagList(Tag... tagList) { if (this.tagList == null) { setTagList(new java.util.ArrayList(tagList.length)); } for (Tag ele : tagList) { this.tagList.add(ele); } return this; } /** *

* The list of tags for the backup. *

* * @param tagList * The list of tags for the backup. * @return Returns a reference to this object so that method calls can be chained together. */ public Backup withTagList(java.util.Collection tagList) { setTagList(tagList); 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 (getBackupId() != null) sb.append("BackupId: ").append(getBackupId()).append(","); if (getBackupState() != null) sb.append("BackupState: ").append(getBackupState()).append(","); if (getClusterId() != null) sb.append("ClusterId: ").append(getClusterId()).append(","); if (getCreateTimestamp() != null) sb.append("CreateTimestamp: ").append(getCreateTimestamp()).append(","); if (getCopyTimestamp() != null) sb.append("CopyTimestamp: ").append(getCopyTimestamp()).append(","); if (getNeverExpires() != null) sb.append("NeverExpires: ").append(getNeverExpires()).append(","); if (getSourceRegion() != null) sb.append("SourceRegion: ").append(getSourceRegion()).append(","); if (getSourceBackup() != null) sb.append("SourceBackup: ").append(getSourceBackup()).append(","); if (getSourceCluster() != null) sb.append("SourceCluster: ").append(getSourceCluster()).append(","); if (getDeleteTimestamp() != null) sb.append("DeleteTimestamp: ").append(getDeleteTimestamp()).append(","); if (getTagList() != null) sb.append("TagList: ").append(getTagList()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Backup == false) return false; Backup other = (Backup) obj; if (other.getBackupId() == null ^ this.getBackupId() == null) return false; if (other.getBackupId() != null && other.getBackupId().equals(this.getBackupId()) == false) return false; if (other.getBackupState() == null ^ this.getBackupState() == null) return false; if (other.getBackupState() != null && other.getBackupState().equals(this.getBackupState()) == false) return false; if (other.getClusterId() == null ^ this.getClusterId() == null) return false; if (other.getClusterId() != null && other.getClusterId().equals(this.getClusterId()) == false) return false; if (other.getCreateTimestamp() == null ^ this.getCreateTimestamp() == null) return false; if (other.getCreateTimestamp() != null && other.getCreateTimestamp().equals(this.getCreateTimestamp()) == false) return false; if (other.getCopyTimestamp() == null ^ this.getCopyTimestamp() == null) return false; if (other.getCopyTimestamp() != null && other.getCopyTimestamp().equals(this.getCopyTimestamp()) == false) return false; if (other.getNeverExpires() == null ^ this.getNeverExpires() == null) return false; if (other.getNeverExpires() != null && other.getNeverExpires().equals(this.getNeverExpires()) == false) return false; if (other.getSourceRegion() == null ^ this.getSourceRegion() == null) return false; if (other.getSourceRegion() != null && other.getSourceRegion().equals(this.getSourceRegion()) == false) return false; if (other.getSourceBackup() == null ^ this.getSourceBackup() == null) return false; if (other.getSourceBackup() != null && other.getSourceBackup().equals(this.getSourceBackup()) == false) return false; if (other.getSourceCluster() == null ^ this.getSourceCluster() == null) return false; if (other.getSourceCluster() != null && other.getSourceCluster().equals(this.getSourceCluster()) == false) return false; if (other.getDeleteTimestamp() == null ^ this.getDeleteTimestamp() == null) return false; if (other.getDeleteTimestamp() != null && other.getDeleteTimestamp().equals(this.getDeleteTimestamp()) == false) return false; if (other.getTagList() == null ^ this.getTagList() == null) return false; if (other.getTagList() != null && other.getTagList().equals(this.getTagList()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getBackupId() == null) ? 0 : getBackupId().hashCode()); hashCode = prime * hashCode + ((getBackupState() == null) ? 0 : getBackupState().hashCode()); hashCode = prime * hashCode + ((getClusterId() == null) ? 0 : getClusterId().hashCode()); hashCode = prime * hashCode + ((getCreateTimestamp() == null) ? 0 : getCreateTimestamp().hashCode()); hashCode = prime * hashCode + ((getCopyTimestamp() == null) ? 0 : getCopyTimestamp().hashCode()); hashCode = prime * hashCode + ((getNeverExpires() == null) ? 0 : getNeverExpires().hashCode()); hashCode = prime * hashCode + ((getSourceRegion() == null) ? 0 : getSourceRegion().hashCode()); hashCode = prime * hashCode + ((getSourceBackup() == null) ? 0 : getSourceBackup().hashCode()); hashCode = prime * hashCode + ((getSourceCluster() == null) ? 0 : getSourceCluster().hashCode()); hashCode = prime * hashCode + ((getDeleteTimestamp() == null) ? 0 : getDeleteTimestamp().hashCode()); hashCode = prime * hashCode + ((getTagList() == null) ? 0 : getTagList().hashCode()); return hashCode; } @Override public Backup clone() { try { return (Backup) 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.cloudhsmv2.model.transform.BackupMarshaller.getInstance().marshall(this, protocolMarshaller); } }