/* * 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 an AWS CloudHSM cluster. *

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

* The cluster's backup policy. *

*/ private String backupPolicy; /** *

* A policy that defines how the service retains backups. *

*/ private BackupRetentionPolicy backupRetentionPolicy; /** *

* The cluster's identifier (ID). *

*/ private String clusterId; /** *

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

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

* Contains information about the HSMs in the cluster. *

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

* The type of HSM that the cluster contains. *

*/ private String hsmType; /** *

* The default password for the cluster's Pre-Crypto Officer (PRECO) user. *

*/ private String preCoPassword; /** *

* The identifier (ID) of the cluster's security group. *

*/ private String securityGroup; /** *

* The identifier (ID) of the backup used to create the cluster. This value exists only when the cluster was created * from a backup. *

*/ private String sourceBackupId; /** *

* The cluster's state. *

*/ private String state; /** *

* A description of the cluster's state. *

*/ private String stateMessage; /** *

* A map from availability zone to the cluster’s subnet in that availability zone. *

*/ private java.util.Map subnetMapping; /** *

* The identifier (ID) of the virtual private cloud (VPC) that contains the cluster. *

*/ private String vpcId; /** *

* Contains one or more certificates or a certificate signing request (CSR). *

*/ private Certificates certificates; /** *

* The list of tags for the cluster. *

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

* The cluster's backup policy. *

* * @param backupPolicy * The cluster's backup policy. * @see BackupPolicy */ public void setBackupPolicy(String backupPolicy) { this.backupPolicy = backupPolicy; } /** *

* The cluster's backup policy. *

* * @return The cluster's backup policy. * @see BackupPolicy */ public String getBackupPolicy() { return this.backupPolicy; } /** *

* The cluster's backup policy. *

* * @param backupPolicy * The cluster's backup policy. * @return Returns a reference to this object so that method calls can be chained together. * @see BackupPolicy */ public Cluster withBackupPolicy(String backupPolicy) { setBackupPolicy(backupPolicy); return this; } /** *

* The cluster's backup policy. *

* * @param backupPolicy * The cluster's backup policy. * @return Returns a reference to this object so that method calls can be chained together. * @see BackupPolicy */ public Cluster withBackupPolicy(BackupPolicy backupPolicy) { this.backupPolicy = backupPolicy.toString(); return this; } /** *

* A policy that defines how the service retains backups. *

* * @param backupRetentionPolicy * A policy that defines how the service retains backups. */ public void setBackupRetentionPolicy(BackupRetentionPolicy backupRetentionPolicy) { this.backupRetentionPolicy = backupRetentionPolicy; } /** *

* A policy that defines how the service retains backups. *

* * @return A policy that defines how the service retains backups. */ public BackupRetentionPolicy getBackupRetentionPolicy() { return this.backupRetentionPolicy; } /** *

* A policy that defines how the service retains backups. *

* * @param backupRetentionPolicy * A policy that defines how the service retains backups. * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster withBackupRetentionPolicy(BackupRetentionPolicy backupRetentionPolicy) { setBackupRetentionPolicy(backupRetentionPolicy); return this; } /** *

* The cluster's identifier (ID). *

* * @param clusterId * The cluster's identifier (ID). */ public void setClusterId(String clusterId) { this.clusterId = clusterId; } /** *

* The cluster's identifier (ID). *

* * @return The cluster's identifier (ID). */ public String getClusterId() { return this.clusterId; } /** *

* The cluster's identifier (ID). *

* * @param clusterId * The cluster's identifier (ID). * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster withClusterId(String clusterId) { setClusterId(clusterId); return this; } /** *

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

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

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

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

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

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

* Contains information about the HSMs in the cluster. *

* * @return Contains information about the HSMs in the cluster. */ public java.util.List getHsms() { return hsms; } /** *

* Contains information about the HSMs in the cluster. *

* * @param hsms * Contains information about the HSMs in the cluster. */ public void setHsms(java.util.Collection hsms) { if (hsms == null) { this.hsms = null; return; } this.hsms = new java.util.ArrayList(hsms); } /** *

* Contains information about the HSMs in the cluster. *

*

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

* * @param hsms * Contains information about the HSMs in the cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster withHsms(Hsm... hsms) { if (this.hsms == null) { setHsms(new java.util.ArrayList(hsms.length)); } for (Hsm ele : hsms) { this.hsms.add(ele); } return this; } /** *

* Contains information about the HSMs in the cluster. *

* * @param hsms * Contains information about the HSMs in the cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster withHsms(java.util.Collection hsms) { setHsms(hsms); return this; } /** *

* The type of HSM that the cluster contains. *

* * @param hsmType * The type of HSM that the cluster contains. */ public void setHsmType(String hsmType) { this.hsmType = hsmType; } /** *

* The type of HSM that the cluster contains. *

* * @return The type of HSM that the cluster contains. */ public String getHsmType() { return this.hsmType; } /** *

* The type of HSM that the cluster contains. *

* * @param hsmType * The type of HSM that the cluster contains. * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster withHsmType(String hsmType) { setHsmType(hsmType); return this; } /** *

* The default password for the cluster's Pre-Crypto Officer (PRECO) user. *

* * @param preCoPassword * The default password for the cluster's Pre-Crypto Officer (PRECO) user. */ public void setPreCoPassword(String preCoPassword) { this.preCoPassword = preCoPassword; } /** *

* The default password for the cluster's Pre-Crypto Officer (PRECO) user. *

* * @return The default password for the cluster's Pre-Crypto Officer (PRECO) user. */ public String getPreCoPassword() { return this.preCoPassword; } /** *

* The default password for the cluster's Pre-Crypto Officer (PRECO) user. *

* * @param preCoPassword * The default password for the cluster's Pre-Crypto Officer (PRECO) user. * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster withPreCoPassword(String preCoPassword) { setPreCoPassword(preCoPassword); return this; } /** *

* The identifier (ID) of the cluster's security group. *

* * @param securityGroup * The identifier (ID) of the cluster's security group. */ public void setSecurityGroup(String securityGroup) { this.securityGroup = securityGroup; } /** *

* The identifier (ID) of the cluster's security group. *

* * @return The identifier (ID) of the cluster's security group. */ public String getSecurityGroup() { return this.securityGroup; } /** *

* The identifier (ID) of the cluster's security group. *

* * @param securityGroup * The identifier (ID) of the cluster's security group. * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster withSecurityGroup(String securityGroup) { setSecurityGroup(securityGroup); return this; } /** *

* The identifier (ID) of the backup used to create the cluster. This value exists only when the cluster was created * from a backup. *

* * @param sourceBackupId * The identifier (ID) of the backup used to create the cluster. This value exists only when the cluster was * created from a backup. */ public void setSourceBackupId(String sourceBackupId) { this.sourceBackupId = sourceBackupId; } /** *

* The identifier (ID) of the backup used to create the cluster. This value exists only when the cluster was created * from a backup. *

* * @return The identifier (ID) of the backup used to create the cluster. This value exists only when the cluster was * created from a backup. */ public String getSourceBackupId() { return this.sourceBackupId; } /** *

* The identifier (ID) of the backup used to create the cluster. This value exists only when the cluster was created * from a backup. *

* * @param sourceBackupId * The identifier (ID) of the backup used to create the cluster. This value exists only when the cluster was * created from a backup. * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster withSourceBackupId(String sourceBackupId) { setSourceBackupId(sourceBackupId); return this; } /** *

* The cluster's state. *

* * @param state * The cluster's state. * @see ClusterState */ public void setState(String state) { this.state = state; } /** *

* The cluster's state. *

* * @return The cluster's state. * @see ClusterState */ public String getState() { return this.state; } /** *

* The cluster's state. *

* * @param state * The cluster's state. * @return Returns a reference to this object so that method calls can be chained together. * @see ClusterState */ public Cluster withState(String state) { setState(state); return this; } /** *

* The cluster's state. *

* * @param state * The cluster's state. * @return Returns a reference to this object so that method calls can be chained together. * @see ClusterState */ public Cluster withState(ClusterState state) { this.state = state.toString(); return this; } /** *

* A description of the cluster's state. *

* * @param stateMessage * A description of the cluster's state. */ public void setStateMessage(String stateMessage) { this.stateMessage = stateMessage; } /** *

* A description of the cluster's state. *

* * @return A description of the cluster's state. */ public String getStateMessage() { return this.stateMessage; } /** *

* A description of the cluster's state. *

* * @param stateMessage * A description of the cluster's state. * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster withStateMessage(String stateMessage) { setStateMessage(stateMessage); return this; } /** *

* A map from availability zone to the cluster’s subnet in that availability zone. *

* * @return A map from availability zone to the cluster’s subnet in that availability zone. */ public java.util.Map getSubnetMapping() { return subnetMapping; } /** *

* A map from availability zone to the cluster’s subnet in that availability zone. *

* * @param subnetMapping * A map from availability zone to the cluster’s subnet in that availability zone. */ public void setSubnetMapping(java.util.Map subnetMapping) { this.subnetMapping = subnetMapping; } /** *

* A map from availability zone to the cluster’s subnet in that availability zone. *

* * @param subnetMapping * A map from availability zone to the cluster’s subnet in that availability zone. * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster withSubnetMapping(java.util.Map subnetMapping) { setSubnetMapping(subnetMapping); return this; } /** * Add a single SubnetMapping entry * * @see Cluster#withSubnetMapping * @returns a reference to this object so that method calls can be chained together. */ public Cluster addSubnetMappingEntry(String key, String value) { if (null == this.subnetMapping) { this.subnetMapping = new java.util.HashMap(); } if (this.subnetMapping.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.subnetMapping.put(key, value); return this; } /** * Removes all the entries added into SubnetMapping. * * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster clearSubnetMappingEntries() { this.subnetMapping = null; return this; } /** *

* The identifier (ID) of the virtual private cloud (VPC) that contains the cluster. *

* * @param vpcId * The identifier (ID) of the virtual private cloud (VPC) that contains the cluster. */ public void setVpcId(String vpcId) { this.vpcId = vpcId; } /** *

* The identifier (ID) of the virtual private cloud (VPC) that contains the cluster. *

* * @return The identifier (ID) of the virtual private cloud (VPC) that contains the cluster. */ public String getVpcId() { return this.vpcId; } /** *

* The identifier (ID) of the virtual private cloud (VPC) that contains the cluster. *

* * @param vpcId * The identifier (ID) of the virtual private cloud (VPC) that contains the cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster withVpcId(String vpcId) { setVpcId(vpcId); return this; } /** *

* Contains one or more certificates or a certificate signing request (CSR). *

* * @param certificates * Contains one or more certificates or a certificate signing request (CSR). */ public void setCertificates(Certificates certificates) { this.certificates = certificates; } /** *

* Contains one or more certificates or a certificate signing request (CSR). *

* * @return Contains one or more certificates or a certificate signing request (CSR). */ public Certificates getCertificates() { return this.certificates; } /** *

* Contains one or more certificates or a certificate signing request (CSR). *

* * @param certificates * Contains one or more certificates or a certificate signing request (CSR). * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster withCertificates(Certificates certificates) { setCertificates(certificates); return this; } /** *

* The list of tags for the cluster. *

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

* The list of tags for the cluster. *

* * @param tagList * The list of tags for the cluster. */ 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 cluster. *

*

* 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 cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster 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 cluster. *

* * @param tagList * The list of tags for the cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public Cluster 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 (getBackupPolicy() != null) sb.append("BackupPolicy: ").append(getBackupPolicy()).append(","); if (getBackupRetentionPolicy() != null) sb.append("BackupRetentionPolicy: ").append(getBackupRetentionPolicy()).append(","); if (getClusterId() != null) sb.append("ClusterId: ").append(getClusterId()).append(","); if (getCreateTimestamp() != null) sb.append("CreateTimestamp: ").append(getCreateTimestamp()).append(","); if (getHsms() != null) sb.append("Hsms: ").append(getHsms()).append(","); if (getHsmType() != null) sb.append("HsmType: ").append(getHsmType()).append(","); if (getPreCoPassword() != null) sb.append("PreCoPassword: ").append(getPreCoPassword()).append(","); if (getSecurityGroup() != null) sb.append("SecurityGroup: ").append(getSecurityGroup()).append(","); if (getSourceBackupId() != null) sb.append("SourceBackupId: ").append(getSourceBackupId()).append(","); if (getState() != null) sb.append("State: ").append(getState()).append(","); if (getStateMessage() != null) sb.append("StateMessage: ").append(getStateMessage()).append(","); if (getSubnetMapping() != null) sb.append("SubnetMapping: ").append(getSubnetMapping()).append(","); if (getVpcId() != null) sb.append("VpcId: ").append(getVpcId()).append(","); if (getCertificates() != null) sb.append("Certificates: ").append(getCertificates()).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 Cluster == false) return false; Cluster other = (Cluster) obj; if (other.getBackupPolicy() == null ^ this.getBackupPolicy() == null) return false; if (other.getBackupPolicy() != null && other.getBackupPolicy().equals(this.getBackupPolicy()) == false) return false; if (other.getBackupRetentionPolicy() == null ^ this.getBackupRetentionPolicy() == null) return false; if (other.getBackupRetentionPolicy() != null && other.getBackupRetentionPolicy().equals(this.getBackupRetentionPolicy()) == 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.getHsms() == null ^ this.getHsms() == null) return false; if (other.getHsms() != null && other.getHsms().equals(this.getHsms()) == false) return false; if (other.getHsmType() == null ^ this.getHsmType() == null) return false; if (other.getHsmType() != null && other.getHsmType().equals(this.getHsmType()) == false) return false; if (other.getPreCoPassword() == null ^ this.getPreCoPassword() == null) return false; if (other.getPreCoPassword() != null && other.getPreCoPassword().equals(this.getPreCoPassword()) == false) return false; if (other.getSecurityGroup() == null ^ this.getSecurityGroup() == null) return false; if (other.getSecurityGroup() != null && other.getSecurityGroup().equals(this.getSecurityGroup()) == false) return false; if (other.getSourceBackupId() == null ^ this.getSourceBackupId() == null) return false; if (other.getSourceBackupId() != null && other.getSourceBackupId().equals(this.getSourceBackupId()) == false) return false; if (other.getState() == null ^ this.getState() == null) return false; if (other.getState() != null && other.getState().equals(this.getState()) == false) return false; if (other.getStateMessage() == null ^ this.getStateMessage() == null) return false; if (other.getStateMessage() != null && other.getStateMessage().equals(this.getStateMessage()) == false) return false; if (other.getSubnetMapping() == null ^ this.getSubnetMapping() == null) return false; if (other.getSubnetMapping() != null && other.getSubnetMapping().equals(this.getSubnetMapping()) == false) return false; if (other.getVpcId() == null ^ this.getVpcId() == null) return false; if (other.getVpcId() != null && other.getVpcId().equals(this.getVpcId()) == false) return false; if (other.getCertificates() == null ^ this.getCertificates() == null) return false; if (other.getCertificates() != null && other.getCertificates().equals(this.getCertificates()) == 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 + ((getBackupPolicy() == null) ? 0 : getBackupPolicy().hashCode()); hashCode = prime * hashCode + ((getBackupRetentionPolicy() == null) ? 0 : getBackupRetentionPolicy().hashCode()); hashCode = prime * hashCode + ((getClusterId() == null) ? 0 : getClusterId().hashCode()); hashCode = prime * hashCode + ((getCreateTimestamp() == null) ? 0 : getCreateTimestamp().hashCode()); hashCode = prime * hashCode + ((getHsms() == null) ? 0 : getHsms().hashCode()); hashCode = prime * hashCode + ((getHsmType() == null) ? 0 : getHsmType().hashCode()); hashCode = prime * hashCode + ((getPreCoPassword() == null) ? 0 : getPreCoPassword().hashCode()); hashCode = prime * hashCode + ((getSecurityGroup() == null) ? 0 : getSecurityGroup().hashCode()); hashCode = prime * hashCode + ((getSourceBackupId() == null) ? 0 : getSourceBackupId().hashCode()); hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode()); hashCode = prime * hashCode + ((getStateMessage() == null) ? 0 : getStateMessage().hashCode()); hashCode = prime * hashCode + ((getSubnetMapping() == null) ? 0 : getSubnetMapping().hashCode()); hashCode = prime * hashCode + ((getVpcId() == null) ? 0 : getVpcId().hashCode()); hashCode = prime * hashCode + ((getCertificates() == null) ? 0 : getCertificates().hashCode()); hashCode = prime * hashCode + ((getTagList() == null) ? 0 : getTagList().hashCode()); return hashCode; } @Override public Cluster clone() { try { return (Cluster) 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.ClusterMarshaller.getInstance().marshall(this, protocolMarshaller); } }