@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode()); hashCode = prime * hashCode + ((getInstanceProfileName() == null) ? 0 : getInstanceProfileName().hashCode()); hashCode = prime * hashCode + ((getInstanceProfileId() == null) ? 0 : getInstanceProfileId().hashCode()); hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode()); hashCode = prime * hashCode + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode()); hashCode = prime * hashCode + ((getRoles() == null) ? 0 : getRoles().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 (getPath() != null) sb.append("Path: ").append(getPath()).append(","); if (getInstanceProfileName() != null) sb.append("InstanceProfileName: ").append(getInstanceProfileName()).append(","); if (getInstanceProfileId() != null) sb.append("InstanceProfileId: ").append(getInstanceProfileId()).append(","); if (getArn() != null) sb.append("Arn: ").append(getArn()).append(","); if (getCreateDate() != null) sb.append("CreateDate: ").append(getCreateDate()).append(","); if (getRoles() != null) sb.append("Roles: ").append(getRoles()); sb.append("}"); return sb.toString(); }
public Collection<String> getIAMRolesRange() { AmazonIdentityManagementClient identityManagementClient = new AmazonIdentityManagementClient(new BasicAWSCredentials(awsAccount.getAccessKeyId(), awsAccount.getAccessSecret())); ListInstanceProfilesResult listInstanceProfilesResult = identityManagementClient.listInstanceProfiles(); List<String> iamRoles = new LinkedList<String>(); for(InstanceProfile instanceProfile: listInstanceProfilesResult.getInstanceProfiles()) { iamRoles.addAll(Collections2.transform(instanceProfile.getRoles(), iamRoleToStringFunction)); } return iamRoles; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode()); hashCode = prime * hashCode + ((getInstanceProfileName() == null) ? 0 : getInstanceProfileName().hashCode()); hashCode = prime * hashCode + ((getInstanceProfileId() == null) ? 0 : getInstanceProfileId().hashCode()); hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode()); hashCode = prime * hashCode + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode()); hashCode = prime * hashCode + ((getRoles() == null) ? 0 : getRoles().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 (getPath() != null) sb.append("Path: ").append(getPath()).append(","); if (getInstanceProfileName() != null) sb.append("InstanceProfileName: ").append(getInstanceProfileName()).append(","); if (getInstanceProfileId() != null) sb.append("InstanceProfileId: ").append(getInstanceProfileId()).append(","); if (getArn() != null) sb.append("Arn: ").append(getArn()).append(","); if (getCreateDate() != null) sb.append("CreateDate: ").append(getCreateDate()).append(","); if (getRoles() != null) sb.append("Roles: ").append(getRoles()); sb.append("}"); return sb.toString(); }
private void scanInstanceProfile(GraphNodeGarbageCollector gc, InstanceProfile instanceProfile) { ObjectNode n = convertAwsObject(instanceProfile, null); NeoRxClient neo4j = getNeoRxClient(); String cypher = "merge (n:AwsInstanceProfile { aws_arn: {a} }) set n += {p}, n.updateTs = timestamp() return n"; neo4j.execCypher(cypher, "a", instanceProfile.getArn(), "p", n).forEach(it -> { gc.MERGE_ACTION.accept(it); }); incrementEntityCount(); LinkageHelper linkage = newLinkageHelper(); linkage.withTargetLabel("AwsIamRole").withFromArn(instanceProfile.getArn()).withLinkLabel("HAS_ROLE") .withTargetValues(instanceProfile.getRoles().stream().map(Role::getArn).collect(Collectors.toList())) .execute(); }