@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateInstanceProfileResult == false) return false; CreateInstanceProfileResult other = (CreateInstanceProfileResult) obj; if (other.getInstanceProfile() == null ^ this.getInstanceProfile() == null) return false; if (other.getInstanceProfile() != null && other.getInstanceProfile().equals(this.getInstanceProfile()) == false) return false; return true; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getInstanceProfile() == null) ? 0 : getInstanceProfile().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 (getInstanceProfile() != null) sb.append("InstanceProfile: ").append(getInstanceProfile()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateInstanceProfileResult == false) return false; CreateInstanceProfileResult other = (CreateInstanceProfileResult) obj; if (other.getInstanceProfile() == null ^ this.getInstanceProfile() == null) return false; if (other.getInstanceProfile() != null && other.getInstanceProfile().equals(this.getInstanceProfile()) == false) return false; return true; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getInstanceProfile() == null) ? 0 : getInstanceProfile().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 (getInstanceProfile() != null) sb.append("InstanceProfile: ").append(getInstanceProfile()); sb.append("}"); return sb.toString(); }
/** * 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; }