if (getCreationDate() != null) sb.append("CreationDate: ").append(getCreationDate()).append(","); if (getImageId() != null) sb.append("ImageId: ").append(getImageId()).append(","); if (getImageLocation() != null) sb.append("ImageLocation: ").append(getImageLocation()).append(",");
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getArchitecture() == null) ? 0 : getArchitecture().hashCode()); hashCode = prime * hashCode + ((getCreationDate() == null) ? 0 : getCreationDate().hashCode()); hashCode = prime * hashCode + ((getImageId() == null) ? 0 : getImageId().hashCode()); hashCode = prime * hashCode + ((getImageLocation() == null) ? 0 : getImageLocation().hashCode()); hashCode = prime * hashCode + ((getImageType() == null) ? 0 : getImageType().hashCode()); hashCode = prime * hashCode + ((getPublic() == null) ? 0 : getPublic().hashCode()); hashCode = prime * hashCode + ((getKernelId() == null) ? 0 : getKernelId().hashCode()); hashCode = prime * hashCode + ((getOwnerId() == null) ? 0 : getOwnerId().hashCode()); hashCode = prime * hashCode + ((getPlatform() == null) ? 0 : getPlatform().hashCode()); hashCode = prime * hashCode + ((getProductCodes() == null) ? 0 : getProductCodes().hashCode()); hashCode = prime * hashCode + ((getRamdiskId() == null) ? 0 : getRamdiskId().hashCode()); hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode()); hashCode = prime * hashCode + ((getBlockDeviceMappings() == null) ? 0 : getBlockDeviceMappings().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getEnaSupport() == null) ? 0 : getEnaSupport().hashCode()); hashCode = prime * hashCode + ((getHypervisor() == null) ? 0 : getHypervisor().hashCode()); hashCode = prime * hashCode + ((getImageOwnerAlias() == null) ? 0 : getImageOwnerAlias().hashCode()); hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getRootDeviceName() == null) ? 0 : getRootDeviceName().hashCode()); hashCode = prime * hashCode + ((getRootDeviceType() == null) ? 0 : getRootDeviceType().hashCode()); hashCode = prime * hashCode + ((getSriovNetSupport() == null) ? 0 : getSriovNetSupport().hashCode()); hashCode = prime * hashCode + ((getStateReason() == null) ? 0 : getStateReason().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getVirtualizationType() == null) ? 0 : getVirtualizationType().hashCode()); return hashCode; }
if (other.getCreationDate() != null && other.getCreationDate().equals(this.getCreationDate()) == false) return false; if (other.getImageId() == null ^ this.getImageId() == null) return false; if (other.getImageId() != null && other.getImageId().equals(this.getImageId()) == false) return false; if (other.getImageLocation() == null ^ this.getImageLocation() == null)
StringBuilder sb = new StringBuilder(); sb.append("{"); if (getImageId() != null) sb.append("ImageId: " + getImageId() + ","); if (getImageLocation() != null) sb.append("ImageLocation: " + getImageLocation() + ","); if (getState() != null) sb.append("State: " + getState() + ",");
int hashCode = 1; hashCode = prime * hashCode + ((getImageId() == null) ? 0 : getImageId().hashCode()); hashCode = prime * hashCode + ((getImageLocation() == null) ? 0 : getImageLocation().hashCode()); hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode());
public String getId() { return image.getImageId(); } }
Image other = (Image)obj; if (other.getImageId() == null ^ this.getImageId() == null) return false; if (other.getImageId() != null && other.getImageId().equals(this.getImageId()) == false) return false; if (other.getImageLocation() == null ^ this.getImageLocation() == null) return false; if (other.getImageLocation() != null && other.getImageLocation().equals(this.getImageLocation()) == false) return false;
return Optional.empty(); } else if (applicableAMIList.size() == 1) { return Optional.of(applicableAMIList.get(0).getImageId()); } else { String environment = ConfigurationContext. if (AMI_TAG_TESTGRID_ENVIRONMENT.equals(amiTag.getKey())) { if (amiTag.getValue().equals(environment)) { return Optional.of(image.getImageId()); } else { logger.warn("Execution environment of TESTGRID_ENVIRONMENT is not set in config.properties."); return Optional.of(applicableAMIList.get(0).getImageId());
protected BlockDeviceMapping getRootBlockDeviceMapping(Image image) { String rootDeviceName = image.getRootDeviceName(); List<BlockDeviceMapping> mappings = image.getBlockDeviceMappings(); for (BlockDeviceMapping mapping : mappings) { String deviceName = mapping.getDeviceName(); if (rootDeviceName.equals(deviceName)) { return mapping; } } throw illegalState("Could not locate the root block device mapping for AMI [%s]", image.getImageId()); }
private List<BlockDeviceMapping> getAmiBlockDeviceMappings() { /* * AmazonEC2#describeImageAttribute does not work due to a bug * https://forums.aws.amazon.com/message.jspa?messageID=231972 */ for (final Image image: getParent().connect().describeImages().getImages()) { if (ami.equals(image.getImageId())) { return image.getBlockDeviceMappings(); } } throw new AmazonClientException("Unable to get AMI device mapping for " + ami); }
if (getCreationDate() != null) sb.append("CreationDate: ").append(getCreationDate()).append(","); if (getImageId() != null) sb.append("ImageId: ").append(getImageId()).append(","); if (getImageLocation() != null) sb.append("ImageLocation: ").append(getImageLocation()).append(",");
private Image getImage() { DescribeImagesRequest request = new DescribeImagesRequest().withImageIds(ami); for (final Image image : getParent().connect().describeImages(request).getImages()) { if (ami.equals(image.getImageId())) { return image; } } throw new AmazonClientException("Unable to find AMI " + ami); }
taupageExpirationTimeProvider.getExpirationTime(region, image.getOwnerId(), image.getImageId())); if (optionalExpirationDate.isPresent()) { final ZonedDateTime expirationDate = optionalExpirationDate.get(); .withMetaInfo(ImmutableMap.of( "ami_owner_id", image.getOwnerId(), "ami_id", image.getImageId(), "ami_name", image.getName(), "expiration_date", expirationDate.toString()))
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getArchitecture() == null) ? 0 : getArchitecture().hashCode()); hashCode = prime * hashCode + ((getCreationDate() == null) ? 0 : getCreationDate().hashCode()); hashCode = prime * hashCode + ((getImageId() == null) ? 0 : getImageId().hashCode()); hashCode = prime * hashCode + ((getImageLocation() == null) ? 0 : getImageLocation().hashCode()); hashCode = prime * hashCode + ((getImageType() == null) ? 0 : getImageType().hashCode()); hashCode = prime * hashCode + ((getPublic() == null) ? 0 : getPublic().hashCode()); hashCode = prime * hashCode + ((getKernelId() == null) ? 0 : getKernelId().hashCode()); hashCode = prime * hashCode + ((getOwnerId() == null) ? 0 : getOwnerId().hashCode()); hashCode = prime * hashCode + ((getPlatform() == null) ? 0 : getPlatform().hashCode()); hashCode = prime * hashCode + ((getProductCodes() == null) ? 0 : getProductCodes().hashCode()); hashCode = prime * hashCode + ((getRamdiskId() == null) ? 0 : getRamdiskId().hashCode()); hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode()); hashCode = prime * hashCode + ((getBlockDeviceMappings() == null) ? 0 : getBlockDeviceMappings().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getEnaSupport() == null) ? 0 : getEnaSupport().hashCode()); hashCode = prime * hashCode + ((getHypervisor() == null) ? 0 : getHypervisor().hashCode()); hashCode = prime * hashCode + ((getImageOwnerAlias() == null) ? 0 : getImageOwnerAlias().hashCode()); hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getRootDeviceName() == null) ? 0 : getRootDeviceName().hashCode()); hashCode = prime * hashCode + ((getRootDeviceType() == null) ? 0 : getRootDeviceType().hashCode()); hashCode = prime * hashCode + ((getSriovNetSupport() == null) ? 0 : getSriovNetSupport().hashCode()); hashCode = prime * hashCode + ((getStateReason() == null) ? 0 : getStateReason().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getVirtualizationType() == null) ? 0 : getVirtualizationType().hashCode()); return hashCode; }
@Override protected void doScan() { AmazonEC2Client c = getClient(); NeoRxClient neoRx = getNeoRxClient(); Preconditions.checkNotNull(neoRx); GraphNodeGarbageCollector gc = newGarbageCollector().bindScannerContext(); DescribeImagesRequest req = new DescribeImagesRequest().withOwners("self"); DescribeImagesResult result = c.describeImages(req); rateLimit(); result.getImages().forEach(i -> { try { ObjectNode n = convertAwsObject(i, getRegion()); String cypher = "merge (x:AwsAmi {aws_arn:{aws_arn}}) set x+={props} set x.updateTs=timestamp() return x"; neoRx.execCypher(cypher, "aws_arn", n.path("aws_arn").asText(), "props",n).forEach( r->{ gc.MERGE_ACTION.accept(r); getShadowAttributeRemover().removeTagAttributes("AwsAmi", n, r); }); incrementEntityCount(); } catch (RuntimeException e) { maybeThrow(e,"problem scanning AMI "+i.getImageId()); } }); }
if (other.getCreationDate() != null && other.getCreationDate().equals(this.getCreationDate()) == false) return false; if (other.getImageId() == null ^ this.getImageId() == null) return false; if (other.getImageId() != null && other.getImageId().equals(this.getImageId()) == false) return false; if (other.getImageLocation() == null ^ this.getImageLocation() == null)