/* * 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 the hardware for the instance. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class InstanceHardware implements Serializable, Cloneable, StructuredPojo { /** ** The number of vCPUs the instance has. *
*/ private Integer cpuCount; /** ** The disks attached to the instance. *
*/ private java.util.List
* The amount of RAM in GB on the instance (e.g., 1.0
).
*
* The number of vCPUs the instance has. *
* * @param cpuCount * The number of vCPUs the instance has. */ public void setCpuCount(Integer cpuCount) { this.cpuCount = cpuCount; } /** ** The number of vCPUs the instance has. *
* * @return The number of vCPUs the instance has. */ public Integer getCpuCount() { return this.cpuCount; } /** ** The number of vCPUs the instance has. *
* * @param cpuCount * The number of vCPUs the instance has. * @return Returns a reference to this object so that method calls can be chained together. */ public InstanceHardware withCpuCount(Integer cpuCount) { setCpuCount(cpuCount); return this; } /** ** The disks attached to the instance. *
* * @return The disks attached to the instance. */ public java.util.List* The disks attached to the instance. *
* * @param disks * The disks attached to the instance. */ public void setDisks(java.util.Collection* The disks attached to the instance. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setDisks(java.util.Collection)} or {@link #withDisks(java.util.Collection)} if you want to override the * existing values. *
* * @param disks * The disks attached to the instance. * @return Returns a reference to this object so that method calls can be chained together. */ public InstanceHardware withDisks(Disk... disks) { if (this.disks == null) { setDisks(new java.util.ArrayList* The disks attached to the instance. *
* * @param disks * The disks attached to the instance. * @return Returns a reference to this object so that method calls can be chained together. */ public InstanceHardware withDisks(java.util.Collection
* The amount of RAM in GB on the instance (e.g., 1.0
).
*
1.0
).
*/
public void setRamSizeInGb(Float ramSizeInGb) {
this.ramSizeInGb = ramSizeInGb;
}
/**
*
* The amount of RAM in GB on the instance (e.g., 1.0
).
*
1.0
).
*/
public Float getRamSizeInGb() {
return this.ramSizeInGb;
}
/**
*
* The amount of RAM in GB on the instance (e.g., 1.0
).
*
1.0
).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public InstanceHardware withRamSizeInGb(Float ramSizeInGb) {
setRamSizeInGb(ramSizeInGb);
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 (getCpuCount() != null)
sb.append("CpuCount: ").append(getCpuCount()).append(",");
if (getDisks() != null)
sb.append("Disks: ").append(getDisks()).append(",");
if (getRamSizeInGb() != null)
sb.append("RamSizeInGb: ").append(getRamSizeInGb());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof InstanceHardware == false)
return false;
InstanceHardware other = (InstanceHardware) obj;
if (other.getCpuCount() == null ^ this.getCpuCount() == null)
return false;
if (other.getCpuCount() != null && other.getCpuCount().equals(this.getCpuCount()) == false)
return false;
if (other.getDisks() == null ^ this.getDisks() == null)
return false;
if (other.getDisks() != null && other.getDisks().equals(this.getDisks()) == false)
return false;
if (other.getRamSizeInGb() == null ^ this.getRamSizeInGb() == null)
return false;
if (other.getRamSizeInGb() != null && other.getRamSizeInGb().equals(this.getRamSizeInGb()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getCpuCount() == null) ? 0 : getCpuCount().hashCode());
hashCode = prime * hashCode + ((getDisks() == null) ? 0 : getDisks().hashCode());
hashCode = prime * hashCode + ((getRamSizeInGb() == null) ? 0 : getRamSizeInGb().hashCode());
return hashCode;
}
@Override
public InstanceHardware clone() {
try {
return (InstanceHardware) 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.InstanceHardwareMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}