@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStackId() == null) ? 0 : getStackId().hashCode()); hashCode = prime * hashCode + ((getEventId() == null) ? 0 : getEventId().hashCode()); hashCode = prime * hashCode + ((getStackName() == null) ? 0 : getStackName().hashCode()); hashCode = prime * hashCode + ((getLogicalResourceId() == null) ? 0 : getLogicalResourceId().hashCode()); hashCode = prime * hashCode + ((getPhysicalResourceId() == null) ? 0 : getPhysicalResourceId().hashCode()); hashCode = prime * hashCode + ((getResourceType() == null) ? 0 : getResourceType().hashCode()); hashCode = prime * hashCode + ((getTimestamp() == null) ? 0 : getTimestamp().hashCode()); hashCode = prime * hashCode + ((getResourceStatus() == null) ? 0 : getResourceStatus().hashCode()); hashCode = prime * hashCode + ((getResourceStatusReason() == null) ? 0 : getResourceStatusReason().hashCode()); hashCode = prime * hashCode + ((getResourceProperties() == null) ? 0 : getResourceProperties().hashCode()); hashCode = prime * hashCode + ((getClientRequestToken() == null) ? 0 : getClientRequestToken().hashCode()); return hashCode; }
private void printEvents(List<StackEvent> stackEvents) { if (printedEvents.isEmpty()) { getLogger().info("==== Events ===="); } stackEvents.stream() .forEach(o -> { String eventId = o.getEventId(); // If we haven't printed the event, then print it and add to list of printed events so we won't print again if (!printedEvents.contains(eventId)) { getLogger().info("{} {} {}: {} {}", o.getTimestamp(), o.getResourceStatus(), o.getResourceType(), o.getLogicalResourceId(), (o.getResourceStatusReason() == null) ? "" : o.getResourceStatusReason()); printedEvents.add(eventId); } }); }
private void printStackEvents() { DescribeStackEventsRequest r = new DescribeStackEventsRequest(); r.withStackName(getExpandedStackName()); DescribeStackEventsResult describeStackEvents = amazonClient.describeStackEvents(r); List<StackEvent> stackEvents = describeStackEvents.getStackEvents(); Collections.reverse(stackEvents); for (StackEvent event : stackEvents) { logger.println(event.getEventId() + " - " + event.getResourceType() + " - " + event.getResourceStatus() + " - " + event.getResourceStatusReason()); } }
private void printEvent(SimpleDateFormat sdf, StackEvent event) { String time = this.padRight(sdf.format(event.getTimestamp()), 25); String logicalResourceId = this.padRight(event.getLogicalResourceId(), 20); String resourceStatus = this.padRight(event.getResourceStatus(), 36); String resourceStatusReason = this.padRight(event.getResourceStatusReason(), 140); this.listener.getLogger().format("| %s | %s | %s | %s |%n", time, logicalResourceId, resourceStatus, resourceStatusReason); }
StackEvent stackEvent = li.previous(); stringBuilder.append(StringUtil.concatStrings( "Status: ", stackEvent.getResourceStatus(), ", ")); stringBuilder.append(StringUtil.concatStrings( "Resource Type: ", stackEvent.getResourceType(), ", ")); stringBuilder.append(StringUtil.concatStrings( "Logical ID: ", stackEvent.getLogicalResourceId(), ", ")); stringBuilder.append(StringUtil.concatStrings( "Status Reason: ", Optional.ofNullable(stackEvent.getResourceStatusReason()).orElse("-"))); stringBuilder.append("\n");
resourceRequirement.setCfnMD5Hash(cfnMD5hash); if (EC2_RESOURCE_IDENTIFIER.equalsIgnoreCase(stackEvent.getResourceType()) && String.valueOf(CREATE_COMPLETE).equals(stackEvent.getResourceStatus())) { String eventProperties = stackEvent.getResourceProperties(); JsonParser parser = new JsonParser(); JsonElement element = parser.parse(eventProperties); } else if (VPC_RESOURCE_IDENTIFIER.equalsIgnoreCase(stackEvent.getResourceType())) { resourceRequirement.setServiceName(NETWORKING_SERVICE_NAME); resourceRequirement.setLimitName(VPC_LIMIT_NAME);
List<StackEvent> stackEvents = new ArrayList<>(); for (StackEvent event : result.getStackEvents()) { if (event.getEventId().equals(lastEventId) || event.getTimestamp().before(startDate)) { break; this.printLine(); lastEventId = stackEvents.get(stackEvents.size() - 1).getEventId();
cloudformation.describeStackEvents(request).getStackEvents() .stream() .filter(e -> e.getResourceStatus().equals("CREATE_FAILED")) .findFirst() .map(StackEvent::getResourceStatusReason)
new TreeSet<>( (o1, o2) -> { return o1.getEventId().compareTo(o2.getEventId()); });
return false; StackEvent other = (StackEvent) obj; if (other.getStackId() == null ^ this.getStackId() == null) return false; if (other.getStackId() != null && other.getStackId().equals(this.getStackId()) == false) return false; if (other.getEventId() == null ^ this.getEventId() == null) return false; if (other.getEventId() != null && other.getEventId().equals(this.getEventId()) == false) return false; if (other.getStackName() == null ^ this.getStackName() == null) return false; if (other.getStackName() != null && other.getStackName().equals(this.getStackName()) == false) return false; if (other.getLogicalResourceId() == null ^ this.getLogicalResourceId() == null) return false; if (other.getLogicalResourceId() != null && other.getLogicalResourceId().equals(this.getLogicalResourceId()) == false) return false; if (other.getPhysicalResourceId() == null ^ this.getPhysicalResourceId() == null) return false; if (other.getPhysicalResourceId() != null && other.getPhysicalResourceId().equals(this.getPhysicalResourceId()) == false) return false; if (other.getResourceType() == null ^ this.getResourceType() == null) return false; if (other.getResourceType() != null && other.getResourceType().equals(this.getResourceType()) == false) return false; if (other.getTimestamp() == null ^ this.getTimestamp() == null) return false; if (other.getTimestamp() != null && other.getTimestamp().equals(this.getTimestamp()) == false)
StringBuilder sb = new StringBuilder(); sb.append("{"); if (getStackId() != null) sb.append("StackId: ").append(getStackId()).append(","); if (getEventId() != null) sb.append("EventId: ").append(getEventId()).append(","); if (getStackName() != null) sb.append("StackName: ").append(getStackName()).append(","); if (getLogicalResourceId() != null) sb.append("LogicalResourceId: ").append(getLogicalResourceId()).append(","); if (getPhysicalResourceId() != null) sb.append("PhysicalResourceId: ").append(getPhysicalResourceId()).append(","); if (getResourceType() != null) sb.append("ResourceType: ").append(getResourceType()).append(","); if (getTimestamp() != null) sb.append("Timestamp: ").append(getTimestamp()).append(","); if (getResourceStatus() != null) sb.append("ResourceStatus: ").append(getResourceStatus()).append(","); if (getResourceStatusReason() != null) sb.append("ResourceStatusReason: ").append(getResourceStatusReason()).append(","); if (getResourceProperties() != null) sb.append("ResourceProperties: ").append(getResourceProperties()).append(","); if (getClientRequestToken() != null) sb.append("ClientRequestToken: ").append(getClientRequestToken()); sb.append("}"); return sb.toString();
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStackId() == null) ? 0 : getStackId().hashCode()); hashCode = prime * hashCode + ((getEventId() == null) ? 0 : getEventId().hashCode()); hashCode = prime * hashCode + ((getStackName() == null) ? 0 : getStackName().hashCode()); hashCode = prime * hashCode + ((getLogicalResourceId() == null) ? 0 : getLogicalResourceId().hashCode()); hashCode = prime * hashCode + ((getPhysicalResourceId() == null) ? 0 : getPhysicalResourceId().hashCode()); hashCode = prime * hashCode + ((getResourceType() == null) ? 0 : getResourceType().hashCode()); hashCode = prime * hashCode + ((getTimestamp() == null) ? 0 : getTimestamp().hashCode()); hashCode = prime * hashCode + ((getResourceStatus() == null) ? 0 : getResourceStatus().hashCode()); hashCode = prime * hashCode + ((getResourceStatusReason() == null) ? 0 : getResourceStatusReason().hashCode()); hashCode = prime * hashCode + ((getResourceProperties() == null) ? 0 : getResourceProperties().hashCode()); hashCode = prime * hashCode + ((getClientRequestToken() == null) ? 0 : getClientRequestToken().hashCode()); return hashCode; }
return false; StackEvent other = (StackEvent) obj; if (other.getStackId() == null ^ this.getStackId() == null) return false; if (other.getStackId() != null && other.getStackId().equals(this.getStackId()) == false) return false; if (other.getEventId() == null ^ this.getEventId() == null) return false; if (other.getEventId() != null && other.getEventId().equals(this.getEventId()) == false) return false; if (other.getStackName() == null ^ this.getStackName() == null) return false; if (other.getStackName() != null && other.getStackName().equals(this.getStackName()) == false) return false; if (other.getLogicalResourceId() == null ^ this.getLogicalResourceId() == null) return false; if (other.getLogicalResourceId() != null && other.getLogicalResourceId().equals(this.getLogicalResourceId()) == false) return false; if (other.getPhysicalResourceId() == null ^ this.getPhysicalResourceId() == null) return false; if (other.getPhysicalResourceId() != null && other.getPhysicalResourceId().equals(this.getPhysicalResourceId()) == false) return false; if (other.getResourceType() == null ^ this.getResourceType() == null) return false; if (other.getResourceType() != null && other.getResourceType().equals(this.getResourceType()) == false) return false; if (other.getTimestamp() == null ^ this.getTimestamp() == null) return false; if (other.getTimestamp() != null && other.getTimestamp().equals(this.getTimestamp()) == false)
StringBuilder sb = new StringBuilder(); sb.append("{"); if (getStackId() != null) sb.append("StackId: ").append(getStackId()).append(","); if (getEventId() != null) sb.append("EventId: ").append(getEventId()).append(","); if (getStackName() != null) sb.append("StackName: ").append(getStackName()).append(","); if (getLogicalResourceId() != null) sb.append("LogicalResourceId: ").append(getLogicalResourceId()).append(","); if (getPhysicalResourceId() != null) sb.append("PhysicalResourceId: ").append(getPhysicalResourceId()).append(","); if (getResourceType() != null) sb.append("ResourceType: ").append(getResourceType()).append(","); if (getTimestamp() != null) sb.append("Timestamp: ").append(getTimestamp()).append(","); if (getResourceStatus() != null) sb.append("ResourceStatus: ").append(getResourceStatus()).append(","); if (getResourceStatusReason() != null) sb.append("ResourceStatusReason: ").append(getResourceStatusReason()).append(","); if (getResourceProperties() != null) sb.append("ResourceProperties: ").append(getResourceProperties()).append(","); if (getClientRequestToken() != null) sb.append("ClientRequestToken: ").append(getClientRequestToken()); sb.append("}"); return sb.toString();