
com.amazonaws.services.ec2.model.InstanceStatus Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ec2 Show documentation
/*
* Copyright 2010-2016 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.ec2.model;
import java.io.Serializable;
/**
*
* Describes the status of an instance.
*
*/
public class InstanceStatus implements Serializable, Cloneable {
/**
*
* The ID of the instance.
*
*/
private String instanceId;
/**
*
* The Availability Zone of the instance.
*
*/
private String availabilityZone;
/**
*
* Any scheduled events associated with the instance.
*
*/
private com.amazonaws.internal.SdkInternalList events;
/**
*
* The intended state of the instance. DescribeInstanceStatus
* requires that an instance be in the running
state.
*
*/
private InstanceState instanceState;
/**
*
* Reports impaired functionality that stems from issues related to the
* systems that support an instance, such as hardware failures and network
* connectivity problems.
*
*/
private InstanceStatusSummary systemStatus;
/**
*
* Reports impaired functionality that stems from issues internal to the
* instance, such as impaired reachability.
*
*/
private InstanceStatusSummary instanceStatus;
/**
*
* 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 InstanceStatus withInstanceId(String instanceId) {
setInstanceId(instanceId);
return this;
}
/**
*
* The Availability Zone of the instance.
*
*
* @param availabilityZone
* The Availability Zone of the instance.
*/
public void setAvailabilityZone(String availabilityZone) {
this.availabilityZone = availabilityZone;
}
/**
*
* The Availability Zone of the instance.
*
*
* @return The Availability Zone of the instance.
*/
public String getAvailabilityZone() {
return this.availabilityZone;
}
/**
*
* The Availability Zone of the instance.
*
*
* @param availabilityZone
* The Availability Zone of the instance.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public InstanceStatus withAvailabilityZone(String availabilityZone) {
setAvailabilityZone(availabilityZone);
return this;
}
/**
*
* Any scheduled events associated with the instance.
*
*
* @return Any scheduled events associated with the instance.
*/
public java.util.List getEvents() {
if (events == null) {
events = new com.amazonaws.internal.SdkInternalList();
}
return events;
}
/**
*
* Any scheduled events associated with the instance.
*
*
* @param events
* Any scheduled events associated with the instance.
*/
public void setEvents(java.util.Collection events) {
if (events == null) {
this.events = null;
return;
}
this.events = new com.amazonaws.internal.SdkInternalList(
events);
}
/**
*
* Any scheduled events associated with the instance.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setEvents(java.util.Collection)} or
* {@link #withEvents(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param events
* Any scheduled events associated with the instance.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public InstanceStatus withEvents(InstanceStatusEvent... events) {
if (this.events == null) {
setEvents(new com.amazonaws.internal.SdkInternalList(
events.length));
}
for (InstanceStatusEvent ele : events) {
this.events.add(ele);
}
return this;
}
/**
*
* Any scheduled events associated with the instance.
*
*
* @param events
* Any scheduled events associated with the instance.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public InstanceStatus withEvents(
java.util.Collection events) {
setEvents(events);
return this;
}
/**
*
* The intended state of the instance. DescribeInstanceStatus
* requires that an instance be in the running
state.
*
*
* @param instanceState
* The intended state of the instance. DescribeInstanceStatus
* requires that an instance be in the running
state.
*/
public void setInstanceState(InstanceState instanceState) {
this.instanceState = instanceState;
}
/**
*
* The intended state of the instance. DescribeInstanceStatus
* requires that an instance be in the running
state.
*
*
* @return The intended state of the instance. DescribeInstanceStatus
* requires that an instance be in the running
state.
*/
public InstanceState getInstanceState() {
return this.instanceState;
}
/**
*
* The intended state of the instance. DescribeInstanceStatus
* requires that an instance be in the running
state.
*
*
* @param instanceState
* The intended state of the instance. DescribeInstanceStatus
* requires that an instance be in the running
state.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public InstanceStatus withInstanceState(InstanceState instanceState) {
setInstanceState(instanceState);
return this;
}
/**
*
* Reports impaired functionality that stems from issues related to the
* systems that support an instance, such as hardware failures and network
* connectivity problems.
*
*
* @param systemStatus
* Reports impaired functionality that stems from issues related to
* the systems that support an instance, such as hardware failures
* and network connectivity problems.
*/
public void setSystemStatus(InstanceStatusSummary systemStatus) {
this.systemStatus = systemStatus;
}
/**
*
* Reports impaired functionality that stems from issues related to the
* systems that support an instance, such as hardware failures and network
* connectivity problems.
*
*
* @return Reports impaired functionality that stems from issues related to
* the systems that support an instance, such as hardware failures
* and network connectivity problems.
*/
public InstanceStatusSummary getSystemStatus() {
return this.systemStatus;
}
/**
*
* Reports impaired functionality that stems from issues related to the
* systems that support an instance, such as hardware failures and network
* connectivity problems.
*
*
* @param systemStatus
* Reports impaired functionality that stems from issues related to
* the systems that support an instance, such as hardware failures
* and network connectivity problems.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public InstanceStatus withSystemStatus(InstanceStatusSummary systemStatus) {
setSystemStatus(systemStatus);
return this;
}
/**
*
* Reports impaired functionality that stems from issues internal to the
* instance, such as impaired reachability.
*
*
* @param instanceStatus
* Reports impaired functionality that stems from issues internal to
* the instance, such as impaired reachability.
*/
public void setInstanceStatus(InstanceStatusSummary instanceStatus) {
this.instanceStatus = instanceStatus;
}
/**
*
* Reports impaired functionality that stems from issues internal to the
* instance, such as impaired reachability.
*
*
* @return Reports impaired functionality that stems from issues internal to
* the instance, such as impaired reachability.
*/
public InstanceStatusSummary getInstanceStatus() {
return this.instanceStatus;
}
/**
*
* Reports impaired functionality that stems from issues internal to the
* instance, such as impaired reachability.
*
*
* @param instanceStatus
* Reports impaired functionality that stems from issues internal to
* the instance, such as impaired reachability.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public InstanceStatus withInstanceStatus(
InstanceStatusSummary instanceStatus) {
setInstanceStatus(instanceStatus);
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getInstanceId() != null)
sb.append("InstanceId: " + getInstanceId() + ",");
if (getAvailabilityZone() != null)
sb.append("AvailabilityZone: " + getAvailabilityZone() + ",");
if (getEvents() != null)
sb.append("Events: " + getEvents() + ",");
if (getInstanceState() != null)
sb.append("InstanceState: " + getInstanceState() + ",");
if (getSystemStatus() != null)
sb.append("SystemStatus: " + getSystemStatus() + ",");
if (getInstanceStatus() != null)
sb.append("InstanceStatus: " + getInstanceStatus());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof InstanceStatus == false)
return false;
InstanceStatus other = (InstanceStatus) obj;
if (other.getInstanceId() == null ^ this.getInstanceId() == null)
return false;
if (other.getInstanceId() != null
&& other.getInstanceId().equals(this.getInstanceId()) == false)
return false;
if (other.getAvailabilityZone() == null
^ this.getAvailabilityZone() == null)
return false;
if (other.getAvailabilityZone() != null
&& other.getAvailabilityZone().equals(
this.getAvailabilityZone()) == false)
return false;
if (other.getEvents() == null ^ this.getEvents() == null)
return false;
if (other.getEvents() != null
&& other.getEvents().equals(this.getEvents()) == false)
return false;
if (other.getInstanceState() == null ^ this.getInstanceState() == null)
return false;
if (other.getInstanceState() != null
&& other.getInstanceState().equals(this.getInstanceState()) == false)
return false;
if (other.getSystemStatus() == null ^ this.getSystemStatus() == null)
return false;
if (other.getSystemStatus() != null
&& other.getSystemStatus().equals(this.getSystemStatus()) == false)
return false;
if (other.getInstanceStatus() == null
^ this.getInstanceStatus() == null)
return false;
if (other.getInstanceStatus() != null
&& other.getInstanceStatus().equals(this.getInstanceStatus()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode
+ ((getInstanceId() == null) ? 0 : getInstanceId().hashCode());
hashCode = prime
* hashCode
+ ((getAvailabilityZone() == null) ? 0 : getAvailabilityZone()
.hashCode());
hashCode = prime * hashCode
+ ((getEvents() == null) ? 0 : getEvents().hashCode());
hashCode = prime
* hashCode
+ ((getInstanceState() == null) ? 0 : getInstanceState()
.hashCode());
hashCode = prime
* hashCode
+ ((getSystemStatus() == null) ? 0 : getSystemStatus()
.hashCode());
hashCode = prime
* hashCode
+ ((getInstanceStatus() == null) ? 0 : getInstanceStatus()
.hashCode());
return hashCode;
}
@Override
public InstanceStatus clone() {
try {
return (InstanceStatus) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}