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

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

Introduction

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

Prototype


public Boolean isEncrypted() 

Source Link

Document

Indicates whether the volume is encrypted.

Usage

From source file:com.vb.aws.services.compute.ec2.EC2UtilsImpl.java

/**
* This method returns all encrypted EBS volumes.
* @param allVolumes// w  w  w.j  ava 2s  .  c o m
* @return returns list of all encrypted EBS volumes.
*/

public List<Volume> getAllEncryptedEBSVolumes(List<Volume> allEBSVolumes) {

    List<Volume> allEncryptedEBSVolumes = new ArrayList<Volume>();

    if (allEBSVolumes != null || allEBSVolumes.size() > 0) {

        for (Volume volume : allEBSVolumes) {
            if (volume.isEncrypted()) {
                allEncryptedEBSVolumes.add(volume);
            }
        }

        List<String> allEncryptedVolumesIds = allEncryptedEBSVolumes.stream().map(e -> e.getVolumeId())
                .collect(Collectors.toList());
        System.out.println("INFO : All Encrypted EBS volumes : " + allEncryptedVolumesIds);
    }

    return allEncryptedEBSVolumes;
}