@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getInstances() == null) ? 0 : getInstances().hashCode()); return hashCode; }
/** * <p> * An array of <code>Instance</code> objects that describe the instances. * </p> * * @param instances * An array of <code>Instance</code> objects that describe the instances. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeInstancesResult withInstances(java.util.Collection<Instance> instances) { setInstances(instances); return this; }
public DescribeInstancesResult unmarshall(JsonUnmarshallerContext context) throws Exception { DescribeInstancesResult describeInstancesResult = new DescribeInstancesResult(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return describeInstancesResult; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("Instances", targetDepth)) { context.nextToken(); describeInstancesResult.setInstances(new ListUnmarshaller<Instance>(InstanceJsonUnmarshaller.getInstance()).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return describeInstancesResult; }
public DescribeInstancesResult unmarshall(JsonUnmarshallerContext context) throws Exception { DescribeInstancesResult describeInstancesResult = new DescribeInstancesResult(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return describeInstancesResult; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("Instances", targetDepth)) { context.nextToken(); describeInstancesResult.setInstances(new ListUnmarshaller<Instance>(InstanceJsonUnmarshaller.getInstance()).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return describeInstancesResult; }
@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; }
/** * <p> * An array of <code>Instance</code> objects that describe the instances. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setInstances(java.util.Collection)} or {@link #withInstances(java.util.Collection)} if you want to * override the existing values. * </p> * * @param instances * An array of <code>Instance</code> objects that describe the instances. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeInstancesResult withInstances(Instance... instances) { if (this.instances == null) { setInstances(new com.amazonaws.internal.SdkInternalList<Instance>(instances.length)); } for (Instance ele : instances) { this.instances.add(ele); } 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 (getInstances() != null) sb.append("Instances: ").append(getInstances()); sb.append("}"); return sb.toString(); }
/** * <p> * An array of <code>Instance</code> objects that describe the instances. * </p> * * @param instances * An array of <code>Instance</code> objects that describe the instances. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeInstancesResult withInstances(java.util.Collection<Instance> instances) { setInstances(instances); return this; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getInstances() == null) ? 0 : getInstances().hashCode()); return hashCode; }
/** * <p> * An array of <code>Instance</code> objects that describe the instances. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setInstances(java.util.Collection)} or {@link #withInstances(java.util.Collection)} if you want to * override the existing values. * </p> * * @param instances * An array of <code>Instance</code> objects that describe the instances. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeInstancesResult withInstances(Instance... instances) { if (this.instances == null) { setInstances(new com.amazonaws.internal.SdkInternalList<Instance>(instances.length)); } for (Instance ele : instances) { this.instances.add(ele); } return this; }
@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; } } }