/* * 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.snowdevicemanagement.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
* The description of an instance. Currently, Amazon EC2 instances are the only supported instance type. *
* * @see AWS * API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Instance implements Serializable, Cloneable, StructuredPojo { /** ** The Amazon Machine Image (AMI) launch index, which you can use to find this instance in the launch group. *
*/ private Integer amiLaunchIndex; /** ** Any block device mapping entries for the instance. *
*/ private java.util.List* The CPU options for the instance. *
*/ private CpuOptions cpuOptions; /** ** When the instance was created. *
*/ private java.util.Date createdAt; /** ** The ID of the AMI used to launch the instance. *
*/ private String imageId; /** ** The ID of the instance. *
*/ private String instanceId; /** ** The instance type. *
*/ private String instanceType; /** ** The private IPv4 address assigned to the instance. *
*/ private String privateIpAddress; /** ** The public IPv4 address assigned to the instance. *
*/ private String publicIpAddress; /** *
* The device name of the root device volume (for example, /dev/sda1
).
*
* The security groups for the instance. *
*/ private java.util.List* When the instance was last updated. *
*/ private java.util.Date updatedAt; /** ** The Amazon Machine Image (AMI) launch index, which you can use to find this instance in the launch group. *
* * @param amiLaunchIndex * The Amazon Machine Image (AMI) launch index, which you can use to find this instance in the launch group. */ public void setAmiLaunchIndex(Integer amiLaunchIndex) { this.amiLaunchIndex = amiLaunchIndex; } /** ** The Amazon Machine Image (AMI) launch index, which you can use to find this instance in the launch group. *
* * @return The Amazon Machine Image (AMI) launch index, which you can use to find this instance in the launch group. */ public Integer getAmiLaunchIndex() { return this.amiLaunchIndex; } /** ** The Amazon Machine Image (AMI) launch index, which you can use to find this instance in the launch group. *
* * @param amiLaunchIndex * The Amazon Machine Image (AMI) launch index, which you can use to find this instance in the launch group. * @return Returns a reference to this object so that method calls can be chained together. */ public Instance withAmiLaunchIndex(Integer amiLaunchIndex) { setAmiLaunchIndex(amiLaunchIndex); return this; } /** ** Any block device mapping entries for the instance. *
* * @return Any block device mapping entries for the instance. */ public java.util.List* Any block device mapping entries for the instance. *
* * @param blockDeviceMappings * Any block device mapping entries for the instance. */ public void setBlockDeviceMappings(java.util.Collection* Any block device mapping entries for the instance. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setBlockDeviceMappings(java.util.Collection)} or {@link #withBlockDeviceMappings(java.util.Collection)} * if you want to override the existing values. *
* * @param blockDeviceMappings * Any block device mapping entries for the instance. * @return Returns a reference to this object so that method calls can be chained together. */ public Instance withBlockDeviceMappings(InstanceBlockDeviceMapping... blockDeviceMappings) { if (this.blockDeviceMappings == null) { setBlockDeviceMappings(new java.util.ArrayList* Any block device mapping entries for the instance. *
* * @param blockDeviceMappings * Any block device mapping entries for the instance. * @return Returns a reference to this object so that method calls can be chained together. */ public Instance withBlockDeviceMappings(java.util.Collection* The CPU options for the instance. *
* * @param cpuOptions * The CPU options for the instance. */ public void setCpuOptions(CpuOptions cpuOptions) { this.cpuOptions = cpuOptions; } /** ** The CPU options for the instance. *
* * @return The CPU options for the instance. */ public CpuOptions getCpuOptions() { return this.cpuOptions; } /** ** The CPU options for the instance. *
* * @param cpuOptions * The CPU options for the instance. * @return Returns a reference to this object so that method calls can be chained together. */ public Instance withCpuOptions(CpuOptions cpuOptions) { setCpuOptions(cpuOptions); return this; } /** ** When the instance was created. *
* * @param createdAt * When the instance was created. */ public void setCreatedAt(java.util.Date createdAt) { this.createdAt = createdAt; } /** ** When the instance was created. *
* * @return When the instance was created. */ public java.util.Date getCreatedAt() { return this.createdAt; } /** ** When the instance was created. *
* * @param createdAt * When the instance was created. * @return Returns a reference to this object so that method calls can be chained together. */ public Instance withCreatedAt(java.util.Date createdAt) { setCreatedAt(createdAt); return this; } /** ** The ID of the AMI used to launch the instance. *
* * @param imageId * The ID of the AMI used to launch the instance. */ public void setImageId(String imageId) { this.imageId = imageId; } /** ** The ID of the AMI used to launch the instance. *
* * @return The ID of the AMI used to launch the instance. */ public String getImageId() { return this.imageId; } /** ** The ID of the AMI used to launch the instance. *
* * @param imageId * The ID of the AMI used to launch the instance. * @return Returns a reference to this object so that method calls can be chained together. */ public Instance withImageId(String imageId) { setImageId(imageId); return this; } /** ** The ID of the instance. *
* * @param instanceId * The ID of the instance. */ public void setInstanceId(String instanceId) { this.instanceId = instanceId; } /** ** The ID of the instance. *
* * @return The ID of the instance. */ public String getInstanceId() { return this.instanceId; } /** ** The ID of the instance. *
* * @param instanceId * The ID of the instance. * @return Returns a reference to this object so that method calls can be chained together. */ public Instance withInstanceId(String instanceId) { setInstanceId(instanceId); return this; } /** ** The instance type. *
* * @param instanceType * The instance type. */ public void setInstanceType(String instanceType) { this.instanceType = instanceType; } /** ** The instance type. *
* * @return The instance type. */ public String getInstanceType() { return this.instanceType; } /** ** The instance type. *
* * @param instanceType * The instance type. * @return Returns a reference to this object so that method calls can be chained together. */ public Instance withInstanceType(String instanceType) { setInstanceType(instanceType); return this; } /** ** The private IPv4 address assigned to the instance. *
* * @param privateIpAddress * The private IPv4 address assigned to the instance. */ public void setPrivateIpAddress(String privateIpAddress) { this.privateIpAddress = privateIpAddress; } /** ** The private IPv4 address assigned to the instance. *
* * @return The private IPv4 address assigned to the instance. */ public String getPrivateIpAddress() { return this.privateIpAddress; } /** ** The private IPv4 address assigned to the instance. *
* * @param privateIpAddress * The private IPv4 address assigned to the instance. * @return Returns a reference to this object so that method calls can be chained together. */ public Instance withPrivateIpAddress(String privateIpAddress) { setPrivateIpAddress(privateIpAddress); return this; } /** ** The public IPv4 address assigned to the instance. *
* * @param publicIpAddress * The public IPv4 address assigned to the instance. */ public void setPublicIpAddress(String publicIpAddress) { this.publicIpAddress = publicIpAddress; } /** ** The public IPv4 address assigned to the instance. *
* * @return The public IPv4 address assigned to the instance. */ public String getPublicIpAddress() { return this.publicIpAddress; } /** ** The public IPv4 address assigned to the instance. *
* * @param publicIpAddress * The public IPv4 address assigned to the instance. * @return Returns a reference to this object so that method calls can be chained together. */ public Instance withPublicIpAddress(String publicIpAddress) { setPublicIpAddress(publicIpAddress); return this; } /** *
* The device name of the root device volume (for example, /dev/sda1
).
*
/dev/sda1
).
*/
public void setRootDeviceName(String rootDeviceName) {
this.rootDeviceName = rootDeviceName;
}
/**
*
* The device name of the root device volume (for example, /dev/sda1
).
*
/dev/sda1
).
*/
public String getRootDeviceName() {
return this.rootDeviceName;
}
/**
*
* The device name of the root device volume (for example, /dev/sda1
).
*
/dev/sda1
).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Instance withRootDeviceName(String rootDeviceName) {
setRootDeviceName(rootDeviceName);
return this;
}
/**
* * The security groups for the instance. *
* * @return The security groups for the instance. */ public java.util.List* The security groups for the instance. *
* * @param securityGroups * The security groups for the instance. */ public void setSecurityGroups(java.util.Collection* The security groups for the instance. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setSecurityGroups(java.util.Collection)} or {@link #withSecurityGroups(java.util.Collection)} if you want * to override the existing values. *
* * @param securityGroups * The security groups for the instance. * @return Returns a reference to this object so that method calls can be chained together. */ public Instance withSecurityGroups(SecurityGroupIdentifier... securityGroups) { if (this.securityGroups == null) { setSecurityGroups(new java.util.ArrayList* The security groups for the instance. *
* * @param securityGroups * The security groups for the instance. * @return Returns a reference to this object so that method calls can be chained together. */ public Instance withSecurityGroups(java.util.Collection* When the instance was last updated. *
* * @param updatedAt * When the instance was last updated. */ public void setUpdatedAt(java.util.Date updatedAt) { this.updatedAt = updatedAt; } /** ** When the instance was last updated. *
* * @return When the instance was last updated. */ public java.util.Date getUpdatedAt() { return this.updatedAt; } /** ** When the instance was last updated. *
* * @param updatedAt * When the instance was last updated. * @return Returns a reference to this object so that method calls can be chained together. */ public Instance withUpdatedAt(java.util.Date updatedAt) { setUpdatedAt(updatedAt); 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 (getAmiLaunchIndex() != null) sb.append("AmiLaunchIndex: ").append(getAmiLaunchIndex()).append(","); if (getBlockDeviceMappings() != null) sb.append("BlockDeviceMappings: ").append(getBlockDeviceMappings()).append(","); if (getCpuOptions() != null) sb.append("CpuOptions: ").append(getCpuOptions()).append(","); if (getCreatedAt() != null) sb.append("CreatedAt: ").append(getCreatedAt()).append(","); if (getImageId() != null) sb.append("ImageId: ").append(getImageId()).append(","); if (getInstanceId() != null) sb.append("InstanceId: ").append(getInstanceId()).append(","); if (getInstanceType() != null) sb.append("InstanceType: ").append(getInstanceType()).append(","); if (getPrivateIpAddress() != null) sb.append("PrivateIpAddress: ").append(getPrivateIpAddress()).append(","); if (getPublicIpAddress() != null) sb.append("PublicIpAddress: ").append(getPublicIpAddress()).append(","); if (getRootDeviceName() != null) sb.append("RootDeviceName: ").append(getRootDeviceName()).append(","); if (getSecurityGroups() != null) sb.append("SecurityGroups: ").append(getSecurityGroups()).append(","); if (getState() != null) sb.append("State: ").append(getState()).append(","); if (getUpdatedAt() != null) sb.append("UpdatedAt: ").append(getUpdatedAt()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Instance == false) return false; Instance other = (Instance) obj; if (other.getAmiLaunchIndex() == null ^ this.getAmiLaunchIndex() == null) return false; if (other.getAmiLaunchIndex() != null && other.getAmiLaunchIndex().equals(this.getAmiLaunchIndex()) == false) return false; if (other.getBlockDeviceMappings() == null ^ this.getBlockDeviceMappings() == null) return false; if (other.getBlockDeviceMappings() != null && other.getBlockDeviceMappings().equals(this.getBlockDeviceMappings()) == false) return false; if (other.getCpuOptions() == null ^ this.getCpuOptions() == null) return false; if (other.getCpuOptions() != null && other.getCpuOptions().equals(this.getCpuOptions()) == false) return false; if (other.getCreatedAt() == null ^ this.getCreatedAt() == null) return false; if (other.getCreatedAt() != null && other.getCreatedAt().equals(this.getCreatedAt()) == false) return false; if (other.getImageId() == null ^ this.getImageId() == null) return false; if (other.getImageId() != null && other.getImageId().equals(this.getImageId()) == false) return false; if (other.getInstanceId() == null ^ this.getInstanceId() == null) return false; if (other.getInstanceId() != null && other.getInstanceId().equals(this.getInstanceId()) == false) return false; if (other.getInstanceType() == null ^ this.getInstanceType() == null) return false; if (other.getInstanceType() != null && other.getInstanceType().equals(this.getInstanceType()) == false) return false; if (other.getPrivateIpAddress() == null ^ this.getPrivateIpAddress() == null) return false; if (other.getPrivateIpAddress() != null && other.getPrivateIpAddress().equals(this.getPrivateIpAddress()) == false) return false; if (other.getPublicIpAddress() == null ^ this.getPublicIpAddress() == null) return false; if (other.getPublicIpAddress() != null && other.getPublicIpAddress().equals(this.getPublicIpAddress()) == false) return false; if (other.getRootDeviceName() == null ^ this.getRootDeviceName() == null) return false; if (other.getRootDeviceName() != null && other.getRootDeviceName().equals(this.getRootDeviceName()) == false) return false; if (other.getSecurityGroups() == null ^ this.getSecurityGroups() == null) return false; if (other.getSecurityGroups() != null && other.getSecurityGroups().equals(this.getSecurityGroups()) == 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.getUpdatedAt() == null ^ this.getUpdatedAt() == null) return false; if (other.getUpdatedAt() != null && other.getUpdatedAt().equals(this.getUpdatedAt()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAmiLaunchIndex() == null) ? 0 : getAmiLaunchIndex().hashCode()); hashCode = prime * hashCode + ((getBlockDeviceMappings() == null) ? 0 : getBlockDeviceMappings().hashCode()); hashCode = prime * hashCode + ((getCpuOptions() == null) ? 0 : getCpuOptions().hashCode()); hashCode = prime * hashCode + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode()); hashCode = prime * hashCode + ((getImageId() == null) ? 0 : getImageId().hashCode()); hashCode = prime * hashCode + ((getInstanceId() == null) ? 0 : getInstanceId().hashCode()); hashCode = prime * hashCode + ((getInstanceType() == null) ? 0 : getInstanceType().hashCode()); hashCode = prime * hashCode + ((getPrivateIpAddress() == null) ? 0 : getPrivateIpAddress().hashCode()); hashCode = prime * hashCode + ((getPublicIpAddress() == null) ? 0 : getPublicIpAddress().hashCode()); hashCode = prime * hashCode + ((getRootDeviceName() == null) ? 0 : getRootDeviceName().hashCode()); hashCode = prime * hashCode + ((getSecurityGroups() == null) ? 0 : getSecurityGroups().hashCode()); hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode()); hashCode = prime * hashCode + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode()); return hashCode; } @Override public Instance clone() { try { return (Instance) 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.snowdevicemanagement.model.transform.InstanceMarshaller.getInstance().marshall(this, protocolMarshaller); } }