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

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

Introduction

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

Prototype


public void setIops(Integer iops) 

Source Link

Document

The number of I/O operations per second (IOPS) that the volume supports.

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   ww  w .  j  a va2 s.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.cloudifysource.esc.driver.provisioning.privateEc2.PrivateEC2CloudifyDriver.java

License:Open Source License

private BlockDeviceMapping createBlockDeviceMapping(final String device, final AWSEC2Volume volumeConfig)
        throws CloudProvisioningException {
    final VolumeProperties volumeProperties = volumeConfig.getProperties();
    final Integer iops = volumeProperties.getIops() == null ? null : volumeProperties.getIops();
    final Integer size = volumeProperties.getSize();
    final String snapshotId = volumeProperties.getSnapshotId() == null ? null
            : volumeProperties.getSnapshotId().getValue();
    final String volumeType = volumeProperties.getVolumeType() == null ? null
            : volumeProperties.getVolumeType().getValue();

    final EbsBlockDevice ebs = new EbsBlockDevice();
    ebs.setIops(iops);
    ebs.setSnapshotId(snapshotId);/*from w w  w. j  a  v  a  2  s.c o  m*/
    ebs.setVolumeSize(size);
    ebs.setVolumeType(volumeType);
    ebs.setDeleteOnTermination(true);

    final BlockDeviceMapping mapping = new BlockDeviceMapping();
    mapping.setDeviceName(device);
    mapping.setEbs(ebs);
    return mapping;
}

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 .  ja va2  s .com*/
        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;

}