@Test public void testWithBlockDeviceMappingStatic() { BlockDeviceMapping mapping = new BlockDeviceMapping.MapNewVolumeToDevice("/dev/sda1", 120, true, null, null, false); RunInstancesOptions options = withBlockDeviceMappings(ImmutableSet .<BlockDeviceMapping> of(mapping)); assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.DeviceName"), ImmutableList.of("/dev/sda1")); assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.VolumeSize"), ImmutableList.of("120")); assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.DeleteOnTermination"), ImmutableList.of("true")); assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.VolumeType"), ImmutableList.of()); }
public RunInstancesOptions withBlockDeviceMappings(Set<? extends BlockDeviceMapping> mappings) { int i = 1; for (BlockDeviceMapping mapping : checkNotNull(mappings, "mappings")) { checkNotNull(mapping.getDeviceName(), "deviceName"); formParameters.put(String.format("BlockDeviceMapping.%d.DeviceName", i), mapping.getDeviceName()); if (mapping.getVirtualName() != null) formParameters.put(String.format("BlockDeviceMapping.%d.VirtualName", i), mapping.getVirtualName()); if (mapping.getEbsSnapshotId() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.SnapshotId", i), mapping.getEbsSnapshotId()); if (mapping.getEbsVolumeSize() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.VolumeSize", i), String.valueOf(mapping.getEbsVolumeSize())); if (mapping.getEbsNoDevice() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.NoDevice", i), String.valueOf(mapping.getEbsNoDevice())); if (mapping.getEbsDeleteOnTermination() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.DeleteOnTermination", i), String.valueOf(mapping.getEbsDeleteOnTermination())); if (mapping.getEbsVolumeType() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.VolumeType", i), mapping.getEbsVolumeType()); if (mapping.getEbsIops() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.Iops", i), String.valueOf(mapping.getEbsIops())); if (mapping.getEbsEncrypted() != null && mapping.getEbsEncrypted()) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.Encrypted", i), String.valueOf(mapping.getEbsEncrypted())); i++; } return this; }
RunInstancesOptions extends BaseEC2RequestOptions { public RunInstancesOptions withBlockDeviceMappings(Set<? extends BlockDeviceMapping> mappings) { int i = 1; for (BlockDeviceMapping mapping : checkNotNull(mappings, "mappings")) { checkNotNull(mapping.getDeviceName(), "deviceName"); formParameters.put(String.format("BlockDeviceMapping.%d.DeviceName", i), mapping.getDeviceName()); if (mapping.getVirtualName() != null) formParameters.put(String.format("BlockDeviceMapping.%d.VirtualName", i), mapping.getVirtualName()); if (mapping.getEbsSnapshotId() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.SnapshotId", i), mapping.getEbsSnapshotId()); if (mapping.getEbsVolumeSize() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.VolumeSize", i), String.valueOf(mapping.getEbsVolumeSize())); if (mapping.getEbsNoDevice() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.NoDevice", i), String.valueOf(mapping.getEbsNoDevice())); if (mapping.getEbsDeleteOnTermination() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.DeleteOnTermination", i), String.valueOf(mapping.getEbsDeleteOnTermination())); if (mapping.getEbsVolumeType() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.VolumeType", i), mapping.getEbsVolumeType()); if (mapping.getEbsIops() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.Iops", i), String.valueOf(mapping.getEbsIops())); if (mapping.getEbsEncrypted() != null && mapping.getEbsEncrypted()) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.Encrypted", i), String.valueOf(mapping.getEbsEncrypted())); i++; } return this; } }
RunInstancesOptions extends BaseEC2RequestOptions { public RunInstancesOptions withBlockDeviceMappings(Set<? extends BlockDeviceMapping> mappings) { int i = 1; for (BlockDeviceMapping mapping : checkNotNull(mappings, "mappings")) { checkNotNull(mapping.getDeviceName(), "deviceName"); formParameters.put(String.format("BlockDeviceMapping.%d.DeviceName", i), mapping.getDeviceName()); if (mapping.getVirtualName() != null) formParameters.put(String.format("BlockDeviceMapping.%d.VirtualName", i), mapping.getVirtualName()); if (mapping.getEbsSnapshotId() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.SnapshotId", i), mapping.getEbsSnapshotId()); if (mapping.getEbsVolumeSize() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.VolumeSize", i), String.valueOf(mapping.getEbsVolumeSize())); if (mapping.getEbsNoDevice() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.NoDevice", i), String.valueOf(mapping.getEbsNoDevice())); if (mapping.getEbsDeleteOnTermination() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.DeleteOnTermination", i), String.valueOf(mapping.getEbsDeleteOnTermination())); if (mapping.getEbsVolumeType() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.VolumeType", i), mapping.getEbsVolumeType()); if (mapping.getEbsIops() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.Iops", i), String.valueOf(mapping.getEbsIops())); if (mapping.getEbsEncrypted() != null && mapping.getEbsEncrypted()) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.Encrypted", i), String.valueOf(mapping.getEbsEncrypted())); i++; } return this; }  }
RunInstancesOptions extends BaseEC2RequestOptions { public RunInstancesOptions withBlockDeviceMappings(Set<? extends BlockDeviceMapping> mappings) { int i = 1; for (BlockDeviceMapping mapping : checkNotNull(mappings, "mappings")) { checkNotNull(mapping.getDeviceName(), "deviceName"); formParameters.put(String.format("BlockDeviceMapping.%d.DeviceName", i), mapping.getDeviceName()); if (mapping.getVirtualName() != null) formParameters.put(String.format("BlockDeviceMapping.%d.VirtualName", i), mapping.getVirtualName()); if (mapping.getEbsSnapshotId() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.SnapshotId", i), mapping.getEbsSnapshotId()); if (mapping.getEbsVolumeSize() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.VolumeSize", i), String.valueOf(mapping.getEbsVolumeSize())); if (mapping.getEbsNoDevice() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.NoDevice", i), String.valueOf(mapping.getEbsNoDevice())); if (mapping.getEbsDeleteOnTermination() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.DeleteOnTermination", i), String.valueOf(mapping.getEbsDeleteOnTermination())); if (mapping.getEbsVolumeType() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.VolumeType", i), mapping.getEbsVolumeType()); if (mapping.getEbsIops() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.Iops", i), String.valueOf(mapping.getEbsIops())); if (mapping.getEbsEncrypted() != null && mapping.getEbsEncrypted()) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.Encrypted", i), String.valueOf(mapping.getEbsEncrypted())); i++; } return this; }  RunInstancesOptions withKeyName(String keyName); RunInstancesOptions withSecurityGroups(String... securityGroups); RunInstancesOptions withSecurityGroups(Iterable<String> securityGroups); RunInstancesOptions withSecurityGroup(String securityGroup); RunInstancesOptions withUserData(byte[] unencodedData); RunInstancesOptions asType(String type); RunInstancesOptions withKernelId(String kernelId); RunInstancesOptions withRamdisk(String ramDiskId); RunInstancesOptions withBlockDeviceMappings(Set<? extends BlockDeviceMapping> mappings); RunInstancesOptions withClientToken(String clientToken); }
RunInstancesOptions extends BaseEC2RequestOptions { public RunInstancesOptions withBlockDeviceMappings(Set<? extends BlockDeviceMapping> mappings) { int i = 1; for (BlockDeviceMapping mapping : checkNotNull(mappings, "mappings")) { checkNotNull(mapping.getDeviceName(), "deviceName"); formParameters.put(String.format("BlockDeviceMapping.%d.DeviceName", i), mapping.getDeviceName()); if (mapping.getVirtualName() != null) formParameters.put(String.format("BlockDeviceMapping.%d.VirtualName", i), mapping.getVirtualName()); if (mapping.getEbsSnapshotId() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.SnapshotId", i), mapping.getEbsSnapshotId()); if (mapping.getEbsVolumeSize() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.VolumeSize", i), String.valueOf(mapping.getEbsVolumeSize())); if (mapping.getEbsNoDevice() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.NoDevice", i), String.valueOf(mapping.getEbsNoDevice())); if (mapping.getEbsDeleteOnTermination() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.DeleteOnTermination", i), String.valueOf(mapping.getEbsDeleteOnTermination())); if (mapping.getEbsVolumeType() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.VolumeType", i), mapping.getEbsVolumeType()); if (mapping.getEbsIops() != null) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.Iops", i), String.valueOf(mapping.getEbsIops())); if (mapping.getEbsEncrypted() != null && mapping.getEbsEncrypted()) formParameters.put(String.format("BlockDeviceMapping.%d.Ebs.Encrypted", i), String.valueOf(mapping.getEbsEncrypted())); i++; } return this; }  RunInstancesOptions withKeyName(String keyName); RunInstancesOptions withSecurityGroups(String... securityGroups); RunInstancesOptions withSecurityGroups(Iterable<String> securityGroups); RunInstancesOptions withSecurityGroup(String securityGroup); RunInstancesOptions withUserData(byte[] unencodedData); RunInstancesOptions asType(String type); RunInstancesOptions withKernelId(String kernelId); RunInstancesOptions withRamdisk(String ramDiskId); RunInstancesOptions withBlockDeviceMappings(Set<? extends BlockDeviceMapping> mappings); RunInstancesOptions withClientToken(String clientToken); static final RunInstancesOptions NONE; }