List of usage examples for com.amazonaws.services.ec2.model Snapshot getStartTime
public java.util.Date getStartTime()
The time stamp when the snapshot was initiated.
From source file:com.netflix.simianarmy.aws.janitor.crawler.EBSSnapshotJanitorCrawler.java
License:Apache License
private List<Resource> getSnapshotResources(String... snapshotIds) { refreshSnapshotToAMIs();//from www. j a va 2 s. c o m List<Resource> resources = new LinkedList<Resource>(); AWSClient awsClient = getAWSClient(); for (Snapshot snapshot : awsClient.describeSnapshots(snapshotIds)) { Resource snapshotResource = new AWSResource().withId(snapshot.getSnapshotId()) .withRegion(getAWSClient().region()).withResourceType(AWSResourceType.EBS_SNAPSHOT) .withLaunchTime(snapshot.getStartTime()).withDescription(snapshot.getDescription()); for (Tag tag : snapshot.getTags()) { LOGGER.debug(String.format("Adding tag %s = %s to resource %s", tag.getKey(), tag.getValue(), snapshotResource.getId())); snapshotResource.setTag(tag.getKey(), tag.getValue()); } snapshotResource.setOwnerEmail(getOwnerEmailForResource(snapshotResource)); ((AWSResource) snapshotResource).setAWSResourceState(snapshot.getState()); Collection<String> amis = snapshotToAMIs.get(snapshotResource.getId()); if (amis != null) { snapshotResource.setAdditionalField(SNAPSHOT_FIELD_AMIS, StringUtils.join(amis, ",")); } resources.add(snapshotResource); } return resources; }
From source file:com.pearson.eidetic.driver.MonitorMethods.java
public void sortSnapshotsByDate(List<Snapshot> comparelist) { if (comparelist == null) { return;//from w w w. ja v a2 s . co m } /** * Here we are looking at if there are more than one current record, we * convert to datetime and compare with now. Given the period, we decide * to take a snapshot or move to new volume. Also, comparelist[0] is * oldest, comparelist[len(comparelist) - 1] is newest. */ if (comparelist.size() > 1) { Collections.sort(comparelist, new Comparator<Snapshot>() { @Override public int compare(Snapshot s1, Snapshot s2) { return s1.getStartTime().compareTo(s2.getStartTime()); } }); } }
From source file:com.pearson.eidetic.driver.threads.EideticSubThreadMethods.java
public int dateCompare(Snapshot snap1, Snapshot snap2) { if (snap1.getStartTime().before(snap2.getStartTime())) { return -1; } else if (snap1.getStartTime().equals(snap2.getStartTime())) { return 0; }/*from www.j a v a 2 s.co m*/ return 1; }
From source file:com.pearson.eidetic.driver.threads.EideticSubThreadMethods.java
@Override public void sortSnapshotsByDate(List<Snapshot> comparelist) { if (comparelist == null) { return;//w w w .ja va 2s . c om } /** * Here we are looking at if there are more than one current record, we * convert to datetime and compare with now. Given the period, we decide * to take a snapshot or move to new volume. Also, comparelist[0] is * oldest, comparelist[len(comparelist) - 1] is newest. */ if (comparelist.size() > 1) { Collections.sort(comparelist, new Comparator<Snapshot>() { @Override public int compare(Snapshot s1, Snapshot s2) { return s1.getStartTime().compareTo(s2.getStartTime()); } }); } }
From source file:com.pearson.eidetic.driver.threads.EideticSubThreadMethods.java
public int getMinutesBetweenNowAndSnapshot(Snapshot snapshot) { DateTime now = new DateTime(); DateTime dt = new DateTime(snapshot.getStartTime()); return Minutes.minutesBetween(dt, now).getMinutes(); }
From source file:com.pearson.eidetic.driver.threads.EideticSubThreadMethods.java
public int getDaysBetweenNowAndSnapshot(Snapshot snapshot) { DateTime now = new DateTime(); DateTime dt = new DateTime(snapshot.getStartTime()); return Days.daysBetween(dt, now).getDays(); }