@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(); }
if (other.getPath() != null && other.getPath().equals(this.getPath()) == false) return false; if (other.getInstanceProfileName() == null ^ this.getInstanceProfileName() == null) return false; if (other.getInstanceProfileName() != null && other.getInstanceProfileName().equals(this.getInstanceProfileName()) == false) return false; if (other.getInstanceProfileId() == null ^ this.getInstanceProfileId() == null)
@Override public AbstractModelList<String> getEc2RolesFromAmazonAccount() { List<InstanceProfile> ec2RolesList = aim.listInstanceProfiles().getInstanceProfiles(); AbstractModelList<String> ec2List; ec2List = ec2RolesList.stream().map( e -> e.getInstanceProfileName() ) .collect( Collectors.toCollection( AbstractModelList<String>::new ) ); return ec2List; }
@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(); }
if (other.getPath() != null && other.getPath().equals(this.getPath()) == false) return false; if (other.getInstanceProfileName() == null ^ this.getInstanceProfileName() == null) return false; if (other.getInstanceProfileName() != null && other.getInstanceProfileName().equals(this.getInstanceProfileName()) == false) return false; if (other.getInstanceProfileId() == null ^ this.getInstanceProfileId() == null)
/** * Retrieves an IAM profile spec for a given IAM role. Note that the role * needs to already exist. The IAM profile is created if it does not already exist. * * @param iamRole name of the IAM role to be retrieved in profile form * @return IAM instance profile or null if iamRole is null */ private IamInstanceProfileSpecification getIamProfileSpec(String iamRole) { if(null != iamRole) { InstanceProfile instanceProfile; try { GetInstanceProfileResult getProfileResult = iamClient.getInstanceProfile(new GetInstanceProfileRequest() .withInstanceProfileName(iamRole)); instanceProfile = getProfileResult.getInstanceProfile(); } catch (NoSuchEntityException e) { // No existing entity, create one CreateInstanceProfileResult createProfileResult = iamClient.createInstanceProfile(new CreateInstanceProfileRequest() .withInstanceProfileName( iamRole)); instanceProfile = createProfileResult.getInstanceProfile(); } if (null != instanceProfile) { return new IamInstanceProfileSpecification() .withName(instanceProfile.getInstanceProfileName()); } } return null; }