@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRoles() == null) ? 0 : getRoles().hashCode()); hashCode = prime * hashCode + ((getIsTruncated() == null) ? 0 : getIsTruncated().hashCode()); hashCode = prime * hashCode + ((getMarker() == null) ? 0 : getMarker().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 (getRoles() != null) sb.append("Roles: ").append(getRoles()).append(","); if (getIsTruncated() != null) sb.append("IsTruncated: ").append(getIsTruncated()).append(","); if (getMarker() != null) sb.append("Marker: ").append(getMarker()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListRolesResult == false) return false; ListRolesResult other = (ListRolesResult) obj; if (other.getRoles() == null ^ this.getRoles() == null) return false; if (other.getRoles() != null && other.getRoles().equals(this.getRoles()) == false) return false; if (other.getIsTruncated() == null ^ this.getIsTruncated() == null) return false; if (other.getIsTruncated() != null && other.getIsTruncated().equals(this.getIsTruncated()) == false) return false; if (other.getMarker() == null ^ this.getMarker() == null) return false; if (other.getMarker() != null && other.getMarker().equals(this.getMarker()) == false) return false; return true; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRoles() == null) ? 0 : getRoles().hashCode()); hashCode = prime * hashCode + ((getIsTruncated() == null) ? 0 : getIsTruncated().hashCode()); hashCode = prime * hashCode + ((getMarker() == null) ? 0 : getMarker().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 (getRoles() != null) sb.append("Roles: ").append(getRoles()).append(","); if (getIsTruncated() != null) sb.append("IsTruncated: ").append(getIsTruncated()).append(","); if (getMarker() != null) sb.append("Marker: ").append(getMarker()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListRolesResult == false) return false; ListRolesResult other = (ListRolesResult) obj; if (other.getRoles() == null ^ this.getRoles() == null) return false; if (other.getRoles() != null && other.getRoles().equals(this.getRoles()) == false) return false; if (other.getIsTruncated() == null ^ this.getIsTruncated() == null) return false; if (other.getIsTruncated() != null && other.getIsTruncated().equals(this.getIsTruncated()) == false) return false; if (other.getMarker() == null ^ this.getMarker() == null) return false; if (other.getMarker() != null && other.getMarker().equals(this.getMarker()) == false) return false; return true; }
/** * Fetch IAM roles. * * @param temporaryCredentials the temporary credentials * @param account the account * @return the map */ public static Map<String,List<Role>> fetchIAMRoles(BasicSessionCredentials temporaryCredentials,String account) { AmazonIdentityManagement iamClient = AmazonIdentityManagementClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(InventoryConstants.REGION_US_WEST_2).build(); List<Role> roles = new ArrayList<>(); ListRolesResult rslt; String marker = null; do{ rslt = iamClient.listRoles(new ListRolesRequest().withMarker(marker)); roles.addAll(rslt.getRoles()); marker = rslt.getMarker(); }while(marker!=null); log.debug(InventoryConstants.ACCOUNT + account +" Type : IAM Roles >> "+roles.size()); Map<String,List<Role>> iamRoles = new HashMap<>(); iamRoles.put(account, roles); return iamRoles; }
nextMarker.ifPresent(request::setMarker); final ListRolesResult listRolesResult = iamClient.listRoles(request); nextMarker = Optional.ofNullable(trimToNull(listRolesResult.getMarker()));
private Set<String> loadRoles() { Set<String> result = new TreeSet<String>(); boolean done = false; String marker = null; do { final ListRolesRequest listRolesRequest = new ListRolesRequest(); listRolesRequest.setMarker(marker); final ListRolesResult listRolesResult = iam.listRoles(listRolesRequest); for (Role r : listRolesResult.getRoles()) { result.add(r.getArn()); } done = (!listRolesResult.isTruncated()); marker = listRolesResult.getMarker(); } while (!done); return result; }
result = iam.listRoles(new ListRolesRequest().withMarker(result.getMarker())); } else { break;