Example usage for com.amazonaws.services.ec2.model EbsBlockDevice setEncrypted

List of usage examples for com.amazonaws.services.ec2.model EbsBlockDevice setEncrypted

Introduction

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

Prototype


public void setEncrypted(Boolean encrypted) 

Source Link

Document

Indicates whether the encryption state of an EBS volume is changed while being restored from a backing snapshot.

Usage

From source file:hudson.plugins.ec2.util.DeviceMappingParser.java

License:Open Source License

private static EbsBlockDevice parseEbs(String blockDevice) {

    String[] parts = blockDevice.split(":");

    EbsBlockDevice ebs = new EbsBlockDevice();
    if (StringUtils.isNotBlank(getOrEmpty(parts, 0))) {
        ebs.setSnapshotId(parts[0]);/*from w  w w .  ja  v  a 2s .c  om*/
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 1))) {
        ebs.setVolumeSize(Integer.valueOf(parts[1]));
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 2))) {
        ebs.setDeleteOnTermination(Boolean.valueOf(parts[2]));
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 3))) {
        ebs.setVolumeType(parts[3]);
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 4))) {
        ebs.setIops(Integer.valueOf(parts[4]));
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 5))) {
        ebs.setEncrypted(parts[5].equals("encrypted"));
    }

    return ebs;
}

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

License:BSD License

protected BlockDeviceMapping parseBlockDeviceMapping(String string) throws InvalidArgumentException {
    BlockDeviceMapping map = new BlockDeviceMapping();
    StringPair pair = new StringPair(string, '=');

    String device = pair.getLeft();
    // if( device.startsWith("/dev/"))
    // device = device.substring(5);

    if (!pair.hasRight()) {
        map.setNoDevice(device);/*from w  w  w .  jav a2 s.c  o m*/
        return map;
    }

    String r = pair.getRight();
    if (r.equals("none")) {
        map.setNoDevice(device);
        return map;
    }

    map.setDeviceName(device);

    // Ephemeral = virtual ?
    if (!r.contains(":")) {
        map.setVirtualName(r);
        return map;
    }

    // Parse out the EBS stuff
    // [snapshot-id]:[volume-size]:[delete-on-termination]:[volume-type[:iops]]:[encrypted]

    String aebs[] = r.split(":");

    EbsBlockDevice ebs = new EbsBlockDevice();

    // [snapshot-id]:
    if (aebs.length >= 1) {
        String snapshotId = aebs[0];
        if (!Util.isBlank(snapshotId))
            ebs.setSnapshotId(snapshotId);

    }
    // :[volume-size]:
    if (aebs.length >= 2) {
        if (!Util.isBlank(aebs[1]))
            ebs.setVolumeSize(new Integer(aebs[1]));

    }

    // [delete-on-termination]:
    if (aebs.length >= 3) {
        if (!Util.isBlank(aebs[2]))
            ebs.setDeleteOnTermination(Boolean.valueOf(Util.parseBoolean(aebs[2])));

    }
    if (aebs.length >= 4) {
        // [volume-type[:iops]]:[encrypted]
        int i = 3;
        if (!Util.isBlank(aebs[i])) {
            ebs.setVolumeType(aebs[i]);
            if (aebs[i].equals(VolumeType.Io1.toString())) {
                i++;
                if (aebs.length <= i || Util.isBlank(aebs[i]))
                    throw new InvalidArgumentException(
                            "EBS block mapping with VolumeType :io1 MUST have PIOPS");
                ebs.setIops(Integer.valueOf(aebs[i]));
            }
            i++;
            if (aebs.length > i)
                ebs.setEncrypted(Util.parseBoolean(aebs[i]));
        }
    }

    map.setEbs(ebs);
    return map;

}