@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStackSummaries() == null) ? 0 : getStackSummaries().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListStacksResult == false) return false; ListStacksResult other = (ListStacksResult) obj; if (other.getStackSummaries() == null ^ this.getStackSummaries() == null) return false; if (other.getStackSummaries() != null && other.getStackSummaries().equals(this.getStackSummaries()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == 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 (getStackSummaries() != null) sb.append("StackSummaries: ").append(getStackSummaries()).append(","); if (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()); sb.append("}"); return sb.toString(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStackSummaries() == null) ? 0 : getStackSummaries().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListStacksResult == false) return false; ListStacksResult other = (ListStacksResult) obj; if (other.getStackSummaries() == null ^ this.getStackSummaries() == null) return false; if (other.getStackSummaries() != null && other.getStackSummaries().equals(this.getStackSummaries()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == 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 (getStackSummaries() != null) sb.append("StackSummaries: ").append(getStackSummaries()).append(","); if (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()); sb.append("}"); return sb.toString(); }
@TaskAction public void listStacks(){ client.listStacks() .getStackSummaries() .stream() .filter(summary -> summary.getDeletionTime() == null) .forEach(stackSummary -> System.out.println(stackSummary.getStackName())); } }
private List<StackSummary> getAllRunningStacks() { client = new AmazonCloudFormationClient(new AWSCredentials() { public String getAWSAccessKeyId() { return awsAccessKey; } public String getAWSSecretKey() { return awsSecretKey; } }); List<String> stackStatusFilters = new ArrayList<String>(); stackStatusFilters.add("UPDATE_COMPLETE"); stackStatusFilters.add("CREATE_COMPLETE"); stackStatusFilters.add("ROLLBACK_COMPLETE"); ListStacksRequest listStacksRequest = new ListStacksRequest(); listStacksRequest.setStackStatusFilters(stackStatusFilters); ListStacksResult result = client.listStacks(listStacksRequest); List<StackSummary> stackSummaries = result.getStackSummaries(); return stackSummaries; }
result.getStackSummaries().stream().filter(x -> namePattern.matcher(x.getStackName()).matches()).findFirst();