use of org.openstack4j.model.storage.block.builder.VolumeSnapshotBuilder in project camel by apache.
the class SnapshotProducer method messageToSnapshot.
private VolumeSnapshot messageToSnapshot(Message message) {
VolumeSnapshot volume = message.getBody(VolumeSnapshot.class);
if (volume == null) {
Map headers = message.getHeaders();
VolumeSnapshotBuilder builder = Builders.volumeSnapshot();
final String name = message.getHeader(OpenstackConstants.NAME, String.class);
ObjectHelper.notEmpty(name, "Name");
builder.name(name);
if (headers.containsKey(OpenstackConstants.DESCRIPTION)) {
builder.description(message.getHeader(OpenstackConstants.DESCRIPTION, String.class));
}
if (headers.containsKey(CinderConstants.VOLUME_ID)) {
builder.volume(message.getHeader(CinderConstants.VOLUME_ID, String.class));
}
if (headers.containsKey(CinderConstants.FORCE)) {
builder.force(message.getHeader(CinderConstants.FORCE, Boolean.class));
}
volume = builder.build();
}
return volume;
}
Aggregations