diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Volume.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Volume.java index 8a77bdbb8e..299e6d9c22 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Volume.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Volume.java @@ -193,40 +193,46 @@ public class Volume { this.snapshotId = builder.snapshotId; this.name = builder.name; this.description = builder.description; - this.metadata = ImmutableMap.copyOf(builder.metadata); + this.metadata = ImmutableMap.copyOf(checkNotNull(builder.metadata, "metadata")); } /** + * @return the id of this volume */ public String getId() { return this.id; } /** + * @return the status of this volume */ public Status getStatus() { return this.status; } /** + * @return the size in GB of this volume */ public int getSize() { return this.size; } /** + * @return the availabilityZone containing this volume */ public String getZone() { return this.zone; } /** + * @return the time this volume was created */ public Date getCreated() { return this.created; } /** + * @return the set of attachments (to Servers) */ @Nullable public Set getAttachments() { @@ -234,6 +240,7 @@ public class Volume { } /** + * @return the type of this volume */ @Nullable public String getVolumeType() { @@ -241,6 +248,7 @@ public class Volume { } /** + * @return the snapshot id this volume is associated with. */ @Nullable public String getSnapshotId() { @@ -248,6 +256,7 @@ public class Volume { } /** + * @return the name of this volume - as displayed in the openstack console */ @Nullable public String getName() { @@ -255,14 +264,13 @@ public class Volume { } /** + * @return the description of this volume - as displayed in the openstack console */ @Nullable public String getDescription() { return this.description; } - /** - */ @Nullable public Map getMetadata() { return Collections.unmodifiableMap(this.metadata); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeAttachment.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeAttachment.java index ef93d9d18b..b6a231d7d1 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeAttachment.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeAttachment.java @@ -18,13 +18,15 @@ */ package org.jclouds.openstack.nova.v1_1.domain; +import static com.google.common.base.Preconditions.checkNotNull; + import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; /** - * An Openstack Nova Volume Attachment + * An Openstack Nova Volume Attachment (describes how Volumes are attached to Servers) */ public class VolumeAttachment { @@ -92,27 +94,28 @@ public class VolumeAttachment { private final String device; protected VolumeAttachment(Builder builder) { - this.id = builder.id; - this.volumeId = builder.volumeId; + this.id = checkNotNull(builder.id, "id"); + this.volumeId = checkNotNull(builder.volumeId, "volumeId"); this.serverId = builder.serverId; this.device = builder.device; } /** + * @return the attachment id (typically the same as #getVolumeId()) */ - @Nullable public String getId() { return this.id; } /** + * @return the id of the volume attached */ - @Nullable public String getVolumeId() { return this.volumeId; } /** + * @return the id of the server the volume is attached to */ @Nullable public String getServerId() { @@ -120,6 +123,7 @@ public class VolumeAttachment { } /** + * @return the device name (e.g. "/dev/vdc") */ @Nullable public String getDevice() { diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeSnapshot.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeSnapshot.java index fa7ca86cb8..b20d47c467 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeSnapshot.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeSnapshot.java @@ -18,6 +18,8 @@ */ package org.jclouds.openstack.nova.v1_1.domain; +import static com.google.common.base.Preconditions.checkNotNull; + import java.util.Date; import org.jclouds.javax.annotation.Nullable; @@ -122,9 +124,9 @@ public class VolumeSnapshot { private final String description; protected VolumeSnapshot(Builder builder) { - this.id = builder.id; - this.volumeId = builder.volumeId; - this.status = builder.status; + this.id = checkNotNull(builder.id, "id"); + this.volumeId = checkNotNull(builder.volumeId, "volumeId"); + this.status = checkNotNull(builder.status, "status"); this.size = builder.size; this.created = builder.created; this.name = builder.name; @@ -132,34 +134,35 @@ public class VolumeSnapshot { } /** + * @return the id of this snapshot */ - @Nullable public String getId() { return this.id; } /** + * @return the id of the Volume this snapshot was taken from */ - @Nullable public String getVolumeId() { return this.volumeId; } /** + * @return the status of this snapshot */ - @Nullable public Volume.Status getStatus() { return this.status; } /** + * @return the size in GB of the volume this snapshot was taken from */ - @Nullable public int getSize() { return this.size; } /** + * @return the data the snapshot was taken */ @Nullable public Date getCreated() { @@ -167,13 +170,16 @@ public class VolumeSnapshot { } /** + * @return the name of this snapshot - as displayed in the openstack console */ @Nullable public String getName() { return this.name; } + /** + * @return the description of this snapshot - as displayed in the openstack console */ @Nullable public String getDescription() {