@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 + ((getSecretAccessKey() == null) ? 0 : getSecretAccessKey().hashCode()); hashCode = prime * hashCode + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode()); return hashCode; }
public AccessKey unmarshall(StaxUnmarshallerContext context) throws Exception { AccessKey accessKey = new AccessKey(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; accessKey.setUserName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; accessKey.setAccessKeyId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; accessKey.setStatus(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; accessKey.setSecretAccessKey(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; accessKey.setCreateDate(DateStaxUnmarshallerFactory.getInstance("iso8601").unmarshall(context)); continue;
private static AWSCredentials createIamAccessKey(AmazonIdentityManagementClient iamClient, String username) { CreateAccessKeyResult accessKeyResult = iamClient.createAccessKey(new CreateAccessKeyRequest().withUserName(username)); AccessKey accessKey = accessKeyResult.getAccessKey(); return new BasicAWSCredentials(accessKey.getAccessKeyId(), accessKey.getSecretAccessKey()); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateAccessKeyResult == false) return false; CreateAccessKeyResult other = (CreateAccessKeyResult) obj; if (other.getAccessKey() == null ^ this.getAccessKey() == null) return false; if (other.getAccessKey() != null && other.getAccessKey().equals(this.getAccessKey()) == false) return false; return true; }
private static AWSCredentials createIamAccessKey(AmazonIdentityManagementClient iamClient, String username) { CreateAccessKeyResult accessKeyResult = iamClient.createAccessKey(new CreateAccessKeyRequest().withUserName(username)); AccessKey accessKey = accessKeyResult.getAccessKey(); return new BasicAWSCredentials(accessKey.getAccessKeyId(), accessKey.getSecretAccessKey()); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateAccessKeyResult == false) return false; CreateAccessKeyResult other = (CreateAccessKeyResult) obj; if (other.getAccessKey() == null ^ this.getAccessKey() == null) return false; if (other.getAccessKey() != null && other.getAccessKey().equals(this.getAccessKey()) == false) return false; return true; }
return false; AccessKey other = (AccessKey) 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.getSecretAccessKey() == null ^ this.getSecretAccessKey() == null) return false; if (other.getSecretAccessKey() != null && other.getSecretAccessKey().equals(this.getSecretAccessKey()) == 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 static AWSCredentials createIamAccessKey(AmazonIdentityManagementClient iamClient, String username) { CreateAccessKeyResult accessKeyResult = iamClient.createAccessKey(new CreateAccessKeyRequest().withUserName(username)); AccessKey accessKey = accessKeyResult.getAccessKey(); return new BasicAWSCredentials(accessKey.getAccessKeyId(), accessKey.getSecretAccessKey()); }
public AccessKey unmarshall(StaxUnmarshallerContext context) throws Exception { AccessKey accessKey = new AccessKey(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; accessKey.setUserName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; accessKey.setAccessKeyId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; accessKey.setStatus(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; accessKey.setSecretAccessKey(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; accessKey.setCreateDate(DateStaxUnmarshallerFactory.getInstance("iso8601").unmarshall(context)); continue;
/** * 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 (getSecretAccessKey() != null) sb.append("SecretAccessKey: ").append("***Sensitive Data Redacted***").append(","); if (getCreateDate() != null) sb.append("CreateDate: ").append(getCreateDate()); sb.append("}"); return sb.toString(); }
private void createAccessKey(Name name, String userName, List<String> keys) { AccessKey accessKey = iam_.createAccessKey(new CreateAccessKeyRequest() .withUserName(userName)).getAccessKey(); // secret.println("#######################################################"); // secret.println("# SAVE THIS ACCESS KEY IN ~/.aws/credentials"); // secret.println("#######################################################"); // secret.format("[%s]%n", userName); // secret.format("aws_access_key_id = %s%n", accessKey.getAccessKeyId()); // secret.format("aws_secret_access_key = %s%n", accessKey.getSecretAccessKey()); // secret.println("#######################################################"); String accessKeyJson = " \"" + name + "\": {\n" + " \"accessKeyId\": \"" + accessKey.getAccessKeyId() + "\",\n" + " \"secretAccessKey\": \"" + accessKey.getSecretAccessKey() + "\"\n" + " }"; keys.add(accessKeyJson); }
@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 + ((getSecretAccessKey() == null) ? 0 : getSecretAccessKey().hashCode()); hashCode = prime * hashCode + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode()); return hashCode; }
System.out.println("#######################################################"); System.out.format("[%s]%n", userName_); System.out.format("aws_access_key_id = %s%n", accessKey.getAccessKeyId()); System.out.format("aws_secret_access_key = %s%n", accessKey.getSecretAccessKey()); System.out.println("#######################################################"); out.format("aws_access_key_id = %s%n", accessKey.getAccessKeyId()); out.format("aws_secret_access_key = %s%n", accessKey.getSecretAccessKey());
return false; AccessKey other = (AccessKey) 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.getSecretAccessKey() == null ^ this.getSecretAccessKey() == null) return false; if (other.getSecretAccessKey() != null && other.getSecretAccessKey().equals(this.getSecretAccessKey()) == 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;
final String id = key.getAccessKey().getAccessKeyId(); if(log.isInfoEnabled()) { log.info(String.format("Map user %s to access key %s", String.format("%s%s", prefix, username), id)); id, key.getAccessKey().getSecretAccessKey());
/** * 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 (getSecretAccessKey() != null) sb.append("SecretAccessKey: ").append("***Sensitive Data Redacted***").append(","); if (getCreateDate() != null) sb.append("CreateDate: ").append(getCreateDate()); sb.append("}"); return sb.toString(); }