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

* Describes an instance snapshot. *

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

* The bundle ID from which the source instance was created (e.g., micro_1_0). *

*/ private String fromBundleId; /** *

* The blueprint ID from which the source instance (e.g., os_debian_8_3). *

*/ private String fromBlueprintId; /** *

* A list of objects describing the disks that were attached to the source instance. *

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

* The bundle ID from which the source instance was created (e.g., micro_1_0). *

* * @param fromBundleId * The bundle ID from which the source instance was created (e.g., micro_1_0). */ public void setFromBundleId(String fromBundleId) { this.fromBundleId = fromBundleId; } /** *

* The bundle ID from which the source instance was created (e.g., micro_1_0). *

* * @return The bundle ID from which the source instance was created (e.g., micro_1_0). */ public String getFromBundleId() { return this.fromBundleId; } /** *

* The bundle ID from which the source instance was created (e.g., micro_1_0). *

* * @param fromBundleId * The bundle ID from which the source instance was created (e.g., micro_1_0). * @return Returns a reference to this object so that method calls can be chained together. */ public InstanceSnapshotInfo withFromBundleId(String fromBundleId) { setFromBundleId(fromBundleId); return this; } /** *

* The blueprint ID from which the source instance (e.g., os_debian_8_3). *

* * @param fromBlueprintId * The blueprint ID from which the source instance (e.g., os_debian_8_3). */ public void setFromBlueprintId(String fromBlueprintId) { this.fromBlueprintId = fromBlueprintId; } /** *

* The blueprint ID from which the source instance (e.g., os_debian_8_3). *

* * @return The blueprint ID from which the source instance (e.g., os_debian_8_3). */ public String getFromBlueprintId() { return this.fromBlueprintId; } /** *

* The blueprint ID from which the source instance (e.g., os_debian_8_3). *

* * @param fromBlueprintId * The blueprint ID from which the source instance (e.g., os_debian_8_3). * @return Returns a reference to this object so that method calls can be chained together. */ public InstanceSnapshotInfo withFromBlueprintId(String fromBlueprintId) { setFromBlueprintId(fromBlueprintId); return this; } /** *

* A list of objects describing the disks that were attached to the source instance. *

* * @return A list of objects describing the disks that were attached to the source instance. */ public java.util.List getFromDiskInfo() { return fromDiskInfo; } /** *

* A list of objects describing the disks that were attached to the source instance. *

* * @param fromDiskInfo * A list of objects describing the disks that were attached to the source instance. */ public void setFromDiskInfo(java.util.Collection fromDiskInfo) { if (fromDiskInfo == null) { this.fromDiskInfo = null; return; } this.fromDiskInfo = new java.util.ArrayList(fromDiskInfo); } /** *

* A list of objects describing the disks that were attached to the source instance. *

*

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

* * @param fromDiskInfo * A list of objects describing the disks that were attached to the source instance. * @return Returns a reference to this object so that method calls can be chained together. */ public InstanceSnapshotInfo withFromDiskInfo(DiskInfo... fromDiskInfo) { if (this.fromDiskInfo == null) { setFromDiskInfo(new java.util.ArrayList(fromDiskInfo.length)); } for (DiskInfo ele : fromDiskInfo) { this.fromDiskInfo.add(ele); } return this; } /** *

* A list of objects describing the disks that were attached to the source instance. *

* * @param fromDiskInfo * A list of objects describing the disks that were attached to the source instance. * @return Returns a reference to this object so that method calls can be chained together. */ public InstanceSnapshotInfo withFromDiskInfo(java.util.Collection fromDiskInfo) { setFromDiskInfo(fromDiskInfo); 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 (getFromBundleId() != null) sb.append("FromBundleId: ").append(getFromBundleId()).append(","); if (getFromBlueprintId() != null) sb.append("FromBlueprintId: ").append(getFromBlueprintId()).append(","); if (getFromDiskInfo() != null) sb.append("FromDiskInfo: ").append(getFromDiskInfo()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof InstanceSnapshotInfo == false) return false; InstanceSnapshotInfo other = (InstanceSnapshotInfo) obj; if (other.getFromBundleId() == null ^ this.getFromBundleId() == null) return false; if (other.getFromBundleId() != null && other.getFromBundleId().equals(this.getFromBundleId()) == false) return false; if (other.getFromBlueprintId() == null ^ this.getFromBlueprintId() == null) return false; if (other.getFromBlueprintId() != null && other.getFromBlueprintId().equals(this.getFromBlueprintId()) == false) return false; if (other.getFromDiskInfo() == null ^ this.getFromDiskInfo() == null) return false; if (other.getFromDiskInfo() != null && other.getFromDiskInfo().equals(this.getFromDiskInfo()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getFromBundleId() == null) ? 0 : getFromBundleId().hashCode()); hashCode = prime * hashCode + ((getFromBlueprintId() == null) ? 0 : getFromBlueprintId().hashCode()); hashCode = prime * hashCode + ((getFromDiskInfo() == null) ? 0 : getFromDiskInfo().hashCode()); return hashCode; } @Override public InstanceSnapshotInfo clone() { try { return (InstanceSnapshotInfo) 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.lightsail.model.transform.InstanceSnapshotInfoMarshaller.getInstance().marshall(this, protocolMarshaller); } }