@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getUserName() == null) ? 0 : getUserName().hashCode()); hashCode = prime * hashCode + ((getAccessKeyId() == null) ? 0 : getAccessKeyId().hashCode()); hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); hashCode = prime * hashCode + ((getCreateDate() == null) ? 0 : getCreateDate().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 (getUserName() != null) sb.append("UserName: ").append(getUserName()).append(","); if (getAccessKeyId() != null) sb.append("AccessKeyId: ").append(getAccessKeyId()).append(","); if (getStatus() != null) sb.append("Status: ").append(getStatus()).append(","); if (getCreateDate() != null) sb.append("CreateDate: ").append(getCreateDate()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AccessKeyMetadata == false) return false; AccessKeyMetadata other = (AccessKeyMetadata) obj; if (other.getUserName() == null ^ this.getUserName() == null) return false; if (other.getUserName() != null && other.getUserName().equals(this.getUserName()) == false) return false; if (other.getAccessKeyId() == null ^ this.getAccessKeyId() == null) return false; if (other.getAccessKeyId() != null && other.getAccessKeyId().equals(this.getAccessKeyId()) == false) return false; if (other.getStatus() == null ^ this.getStatus() == null) return false; if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false) return false; if (other.getCreateDate() == null ^ this.getCreateDate() == null) return false; if (other.getCreateDate() != null && other.getCreateDate().equals(this.getCreateDate()) == false) return false; return true; }
private Map<?, ?> metaMap(final AccessKeyMetadata accessKey) { return ImmutableMap.builder() .put("access_key_id", accessKey.getAccessKeyId()) .put("user_name", accessKey.getUserName()) .put("access_key_created", accessKey.getCreateDate()) .build(); } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getUserName() == null) ? 0 : getUserName().hashCode()); hashCode = prime * hashCode + ((getAccessKeyId() == null) ? 0 : getAccessKeyId().hashCode()); hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); hashCode = prime * hashCode + ((getCreateDate() == null) ? 0 : getCreateDate().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 (getUserName() != null) sb.append("UserName: ").append(getUserName()).append(","); if (getAccessKeyId() != null) sb.append("AccessKeyId: ").append(getAccessKeyId()).append(","); if (getStatus() != null) sb.append("Status: ").append(getStatus()).append(","); if (getCreateDate() != null) sb.append("CreateDate: ").append(getCreateDate()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AccessKeyMetadata == false) return false; AccessKeyMetadata other = (AccessKeyMetadata) obj; if (other.getUserName() == null ^ this.getUserName() == null) return false; if (other.getUserName() != null && other.getUserName().equals(this.getUserName()) == false) return false; if (other.getAccessKeyId() == null ^ this.getAccessKeyId() == null) return false; if (other.getAccessKeyId() != null && other.getAccessKeyId().equals(this.getAccessKeyId()) == false) return false; if (other.getStatus() == null ^ this.getStatus() == null) return false; if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false) return false; if (other.getCreateDate() == null ^ this.getCreateDate() == null) return false; if (other.getCreateDate() != null && other.getCreateDate().equals(this.getCreateDate()) == false) return false; return true; }
/** * Instantiates a new access key metadata VH. * * @param access the access */ public AccessKeyMetadataVH(AccessKeyMetadata access){ this.setAccessKeyId(access.getAccessKeyId()); this.setCreateDate(access.getCreateDate()); this.setUserName(access.getUserName()); this.setStatus(access.getStatus()); }
void writeViolation(final String accountId, final AccessKeyMetadata accessKey) { log.info("Found user {} with expired access key {} in account {}", accessKey.getUserName(), accessKey.getAccessKeyId(), accountId); violationSink.put( new ViolationBuilder() .withAccountId(accountId) .withRegion(NoPasswordViolationWriter.NO_REGION) .withEventId("check-access-key_" + accessKey.getAccessKeyId()) .withType(ACTIVE_KEY_TOO_OLD) .withPluginFullyQualifiedClassName(KeyRotationJob.class) .withMetaInfo(metaMap(accessKey)) .build()); }