Example usage for com.amazonaws.services.ec2.model Volume getCreateTime

List of usage examples for com.amazonaws.services.ec2.model Volume getCreateTime

Introduction

In this page you can find the example usage for com.amazonaws.services.ec2.model Volume getCreateTime.

Prototype


public java.util.Date getCreateTime() 

Source Link

Document

The time stamp when volume creation was initiated.

Usage

From source file:com.netflix.simianarmy.aws.janitor.crawler.EBSVolumeJanitorCrawler.java

License:Apache License

private List<Resource> getVolumeResources(String... volumeIds) {
    List<Resource> resources = new LinkedList<Resource>();

    AWSClient awsClient = getAWSClient();

    for (Volume volume : awsClient.describeVolumes(volumeIds)) {
        Resource volumeResource = new AWSResource().withId(volume.getVolumeId())
                .withRegion(getAWSClient().region()).withResourceType(AWSResourceType.EBS_VOLUME)
                .withLaunchTime(volume.getCreateTime());
        for (Tag tag : volume.getTags()) {
            LOGGER.info(String.format("Adding tag %s = %s to resource %s", tag.getKey(), tag.getValue(),
                    volumeResource.getId()));
            volumeResource.setTag(tag.getKey(), tag.getValue());
        }/*from w  w  w  .j  av  a2 s.com*/
        volumeResource.setOwnerEmail(getOwnerEmailForResource(volumeResource));
        volumeResource.setDescription(getVolumeDescription(volume));
        ((AWSResource) volumeResource).setAWSResourceState(volume.getState());
        resources.add(volumeResource);
    }
    return resources;
}

From source file:org.xmlsh.aws.util.AWSEC2Command.java

License:BSD License

protected void writeVolume(Volume volume) throws XMLStreamException {
    startElement("volume");

    attribute("volume-id", volume.getVolumeId());
    attribute("snapshot-id ", volume.getSnapshotId());
    attribute("availability-zone", volume.getAvailabilityZone());
    attribute("create-date", Util.formatXSDateTime(volume.getCreateTime()));
    attribute("size", volume.getSize().toString());
    attribute("state", volume.getState());
    attribute("volume-type", volume.getVolumeType());
    attribute("iops", volume.getIops());
    attribute("encrypted", volume.getEncrypted());
    attribute("kms-key-id", volume.getKmsKeyId());

    writeAttachements(volume.getAttachments());
    writeTags(volume.getTags());// w  ww  .  j  a v a2  s  .  c o  m
}