@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAutoScalingGroups() == null) ? 0 : getAutoScalingGroups().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); return hashCode; }
/** * 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 (getAutoScalingGroups() != null) sb.append("AutoScalingGroups: ").append(getAutoScalingGroups()).append(","); if (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeAutoScalingGroupsResult == false) return false; DescribeAutoScalingGroupsResult other = (DescribeAutoScalingGroupsResult) obj; if (other.getAutoScalingGroups() == null ^ this.getAutoScalingGroups() == null) return false; if (other.getAutoScalingGroups() != null && other.getAutoScalingGroups().equals(this.getAutoScalingGroups()) == 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; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAutoScalingGroups() == null) ? 0 : getAutoScalingGroups().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); return hashCode; }
/** * 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 (getAutoScalingGroups() != null) sb.append("AutoScalingGroups: " + getAutoScalingGroups() + ","); if (getNextToken() != null) sb.append("NextToken: " + getNextToken()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeAutoScalingGroupsResult == false) return false; DescribeAutoScalingGroupsResult other = (DescribeAutoScalingGroupsResult) obj; if (other.getAutoScalingGroups() == null ^ this.getAutoScalingGroups() == null) return false; if (other.getAutoScalingGroups() != null && other.getAutoScalingGroups().equals(this.getAutoScalingGroups()) == 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; } }
private String matchAutoScalingGroupName(String regex) { DescribeAutoScalingGroupsResult result = awsAsClient.describeAutoScalingGroups(new DescribeAutoScalingGroupsRequest()); List<String> groups = toGroupNameList(result.getAutoScalingGroups()); while (result.getNextToken() != null && !result.getNextToken().isEmpty()) { result = awsAsClient.describeAutoScalingGroups(new DescribeAutoScalingGroupsRequest().withNextToken(result.getNextToken())); groups.addAll(toGroupNameList(result.getAutoScalingGroups())); } List<String> matchedGroups = groups.stream().filter(name -> name.matches(regex)).collect(Collectors.toList()); if (matchedGroups == null || matchedGroups.isEmpty() || matchedGroups.size() != 1) { int matchSize = matchedGroups == null ? -1 : matchedGroups.size(); if (matchedGroups != null && matchSize > 0) { matchedGroups.forEach(group -> log.error("Matched group : " + group)); } throw new IllegalStateException("Unable to match group regex, matched group size " + matchSize); } return matchedGroups.stream().findFirst().orElse(regex); }
launchConfigurationNames.add(_asg.getLaunchConfigurationName()); nextToken = describeResult.getNextToken(); }while(nextToken!=null); List<String> launchConfigurationNamesTemp = new ArrayList<>();
describeResult = asgClient.describeAutoScalingGroups(new DescribeAutoScalingGroupsRequest().withNextToken(nextToken).withMaxRecords(asgMaxRecord)); asgListTemp.addAll(describeResult.getAutoScalingGroups()); nextToken = describeResult.getNextToken(); }while(nextToken!=null);
private void forEachAsg(Consumer<AutoScalingGroup> consumer, String... asgNames) { DescribeAutoScalingGroupsRequest request = new DescribeAutoScalingGroupsRequest(); if (asgNames != null && asgNames.length > 0) { request.withAutoScalingGroupNames(asgNames); } String token = null; do { rateLimit(); DescribeAutoScalingGroupsResult results = getClient().describeAutoScalingGroups(request); token = results.getNextToken(); results.getAutoScalingGroups().forEach(consumer); request.setNextToken(token); } while (tokenHasNext(token)); }
_scalingPolicyList.addAll(asgClient.describePolicies(new DescribePoliciesRequest().withAutoScalingGroupName(_asg.getAutoScalingGroupName())).getScalingPolicies()); nextToken = describeResult.getNextToken(); }while(nextToken!=null);