@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getInstances() == null) ? 0 : getInstances().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeInstancesResult == false) return false; DescribeInstancesResult other = (DescribeInstancesResult) obj; if (other.getInstances() == null ^ this.getInstances() == null) return false; if (other.getInstances() != null && other.getInstances().equals(this.getInstances()) == false) return false; return true; }
/** * 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 (getInstances() != null) sb.append("Instances: ").append(getInstances()); sb.append("}"); return sb.toString(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getInstances() == null) ? 0 : getInstances().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeInstancesResult == false) return false; DescribeInstancesResult other = (DescribeInstancesResult) obj; if (other.getInstances() == null ^ this.getInstances() == null) return false; if (other.getInstances() != null && other.getInstances().equals(this.getInstances()) == false) return false; return true; }
/** * 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 (getInstances() != null) sb.append("Instances: ").append(getInstances()); sb.append("}"); return sb.toString(); }
public static void waitForOpsworksInstanceToReachState( AWSOpsWorksClient client, String instanceId, String state) throws InterruptedException { System.out.println("Waiting for instance " + instanceId + " to transition to " + state); int count = 0; while (true) { Thread.sleep(1000 * 30); if (count++ > 100) { throw new RuntimeException("Never reached " + state); } Instance instance = client .describeInstances( new DescribeInstancesRequest() .withInstanceIds(instanceId)) .getInstances().get(0); String status = instance.getStatus(); System.out.println(status); if (status.contains("failed")) { throw new RuntimeException("instance failed to launch"); } if (!status.equalsIgnoreCase(state)) { continue; } return; } } }