@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; }
public InstanceProfile unmarshall(StaxUnmarshallerContext context) throws Exception { InstanceProfile instanceProfile = new InstanceProfile(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; instanceProfile.setPath(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; instanceProfile.setInstanceProfileName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; instanceProfile.setInstanceProfileId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; instanceProfile.setArn(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; instanceProfile.setCreateDate(DateStaxUnmarshallerFactory.getInstance("iso8601").unmarshall(context)); continue; instanceProfile.withRoles(new ArrayList<Role>()); continue; instanceProfile.withRoles(RoleStaxUnmarshaller.getInstance().unmarshall(context)); continue;
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetInstanceProfileResult == false) return false; GetInstanceProfileResult other = (GetInstanceProfileResult) obj; if (other.getInstanceProfile() == null ^ this.getInstanceProfile() == null) return false; if (other.getInstanceProfile() != null && other.getInstanceProfile().equals(this.getInstanceProfile()) == false) return false; return true; }
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(); }
@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; }
private CreateStackTask readyStackTask() { CreateStackTask stackTask = new CreateStackTask(); stackTask.setProject(project); stackTask.setName("AntTaskTestStack"); stackTask.setRegion("us-east-1"); stackTask .setDefaultInstanceProfileArn(iamClient .getInstanceProfile( new GetInstanceProfileRequest() .withInstanceProfileName("aws-opsworks-ec2-role")) .getInstanceProfile().getArn()); stackTask.setServiceRoleArn(iamClient .getRole( new GetRoleRequest() .withRoleName("aws-opsworks-service-role")) .getRole().getArn()); return stackTask; }
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 + ((getInstanceProfile() == null) ? 0 : getInstanceProfile().hashCode()); return hashCode; }
/** * 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; }
/** * Sets the "instanceProfile" and "serviceRole" properties according to the * set parameters. */ public void execute() { checkParams(); AmazonIdentityManagementClient iamClient = getOrCreateClient(AmazonIdentityManagementClient.class); getProject() .setProperty( "instanceProfileArn", iamClient .getInstanceProfile( new GetInstanceProfileRequest() .withInstanceProfileName(instanceProfile)) .getInstanceProfile().getArn()); getProject() .setProperty( "serviceRoleArn", iamClient .getRole( new GetRoleRequest() .withRoleName(serviceRole)) .getRole().getArn()); } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getInstanceProfile() == null) ? 0 : getInstanceProfile().hashCode()); return hashCode; }
return false; InstanceProfile other = (InstanceProfile) obj; if (other.getPath() == null ^ this.getPath() == null) return false; 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) return false; if (other.getInstanceProfileId() != null && other.getInstanceProfileId().equals(this.getInstanceProfileId()) == false) return false; if (other.getArn() == null ^ this.getArn() == null) return false; if (other.getArn() != null && other.getArn().equals(this.getArn()) == false) return false; if (other.getCreateDate() == null ^ this.getCreateDate() == null) return false; if (other.getCreateDate() != null && other.getCreateDate().equals(this.getCreateDate()) == false) return false; if (other.getRoles() == null ^ this.getRoles() == null) return false; if (other.getRoles() != null && other.getRoles().equals(this.getRoles()) == false) return false; return true;
public InstanceProfile unmarshall(StaxUnmarshallerContext context) throws Exception { InstanceProfile instanceProfile = new InstanceProfile(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; instanceProfile.setPath(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; instanceProfile.setInstanceProfileName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; instanceProfile.setInstanceProfileId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; instanceProfile.setArn(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; instanceProfile.setCreateDate(DateStaxUnmarshallerFactory.getInstance("iso8601").unmarshall(context)); continue; instanceProfile.withRoles(new ArrayList<Role>()); continue; instanceProfile.withRoles(RoleStaxUnmarshaller.getInstance().unmarshall(context)); continue;
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getInstanceProfile() == null) ? 0 : getInstanceProfile().hashCode()); return hashCode; }
@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; }
/** * 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(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getInstanceProfile() == null) ? 0 : getInstanceProfile().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetInstanceProfileResult == false) return false; GetInstanceProfileResult other = (GetInstanceProfileResult) 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 + ((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; }
@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; }