use of com.amazonaws.services.ec2.model.BlockDeviceMapping in project photon-model by vmware.
the class TestAWSProvisionTask method getVolume.
protected Volume getVolume(AmazonEC2AsyncClient client, Instance awsInstance, String deviceName) {
InstanceBlockDeviceMapping bootDiskMapping = awsInstance.getBlockDeviceMappings().stream().filter(blockDeviceMapping -> blockDeviceMapping.getDeviceName().equals(deviceName)).findAny().orElse(null);
// The ami used in this test is an ebs-backed AMI
assertNotNull("Device type should be ebs type", bootDiskMapping.getEbs());
String bootVolumeId = bootDiskMapping.getEbs().getVolumeId();
DescribeVolumesRequest describeVolumesRequest = new DescribeVolumesRequest().withVolumeIds(bootVolumeId);
DescribeVolumesResult describeVolumesResult = client.describeVolumes(describeVolumesRequest);
return describeVolumesResult.getVolumes().get(0);
}
Aggregations