return response;
}
public static CreateVolumeResponse toCreateVolumeResponse(EC2Volume engineResponse) {
CreateVolumeResponse response = new CreateVolumeResponse();
CreateVolumeResponseType param1 = new CreateVolumeResponseType();
param1.setVolumeId(engineResponse.getId().toString());
Long volSize = new Long(engineResponse.getSize());
param1.setSize(volSize.toString());
if (engineResponse.getSnapshotId() != null)
param1.setSnapshotId(engineResponse.getSnapshotId());
else
param1.setSnapshotId("");
param1.setAvailabilityZone(engineResponse.getZoneName());
if (null != engineResponse.getState())
param1.setStatus(engineResponse.getState());
else
param1.setStatus(""); // ToDo - throw an Soap Fault
// -> CloudStack seems to have issues with timestamp formats so just in case
Calendar cal = EC2RestAuth.parseDateString(engineResponse.getCreated());
if (null == cal) {
cal = Calendar.getInstance();
// cal.set( 1970, 1, 1 );
}
param1.setCreateTime(cal);
param1.setVolumeType("standard");
param1.setRequestId(UUID.randomUUID().toString());
response.setCreateVolumeResponse(param1);
return response;
}