@@ -46,8 +46,7 @@ public AttachedDisk apply(
4646 };
4747 static final Function <AttachedDisk , com .google .api .services .compute .model .AttachedDisk >
4848 TO_PB_FUNCTION =
49- new Function <AttachedDisk ,
50- com .google .api .services .compute .model .AttachedDisk >() {
49+ new Function <AttachedDisk , com .google .api .services .compute .model .AttachedDisk >() {
5150 @ Override
5251 public com .google .api .services .compute .model .AttachedDisk apply (
5352 AttachedDisk attachedDisk ) {
@@ -233,7 +232,9 @@ public static final class Builder {
233232 private Boolean boot ;
234233 private Boolean autoDelete ;
235234
236- private Builder () {}
235+ private Builder (DiskId sourceDisk ) {
236+ this .sourceDisk = checkNotNull (sourceDisk );
237+ }
237238
238239 private Builder (PersistentDiskConfiguration configuration ) {
239240 sourceDisk = configuration .sourceDisk ;
@@ -261,8 +262,8 @@ public Builder mode(Mode mode) {
261262
262263 /**
263264 * Sets whether to use the attached disk as a boot disk. If {@code true} the virtual machine
264- * will use the first partition of the disk for its root filesystem. If not specified, the
265- * disk is not used as a boot disk.
265+ * instance will use the first partition of the disk for its root filesystem. If not
266+ * specified, the isk is not used as a boot disk.
266267 */
267268 public Builder boot (boolean boot ) {
268269 this .boot = boot ;
@@ -288,7 +289,7 @@ public PersistentDiskConfiguration build() {
288289
289290 PersistentDiskConfiguration (Builder builder ) {
290291 super (Type .PERSISTENT , null , builder .boot , builder .autoDelete );
291- this .sourceDisk = checkNotNull ( builder .sourceDisk ) ;
292+ this .sourceDisk = builder .sourceDisk ;
292293 this .mode = builder .mode ;
293294 }
294295
@@ -353,7 +354,7 @@ com.google.api.services.compute.model.AttachedDisk toPb() {
353354 * persistent disk to attach.
354355 */
355356 public static Builder builder (DiskId sourceDisk ) {
356- return new Builder (). sourceDisk ( sourceDisk );
357+ return new Builder (sourceDisk );
357358 }
358359
359360 /**
@@ -367,8 +368,7 @@ public static PersistentDiskConfiguration of(DiskId sourceDisk) {
367368 @ SuppressWarnings ("unchecked" )
368369 static PersistentDiskConfiguration fromPb (
369370 com .google .api .services .compute .model .AttachedDisk diskPb ) {
370- Builder builder = new Builder ();
371- builder .sourceDisk (DiskId .fromUrl (diskPb .getSource ()));
371+ Builder builder = new Builder (DiskId .fromUrl (diskPb .getSource ()));
372372 if (diskPb .getMode () != null ) {
373373 builder .mode (Mode .valueOf (diskPb .getMode ()));
374374 }
@@ -385,7 +385,9 @@ static PersistentDiskConfiguration fromPb(
385385 /**
386386 * An attached disk configuration for bootable persistent disks that must be created with the
387387 * instance they are attached to. Attached disks that use this configuration can only be attached
388- * to an instance upon creation.
388+ * to an instance upon creation. A {@code CreateDiskConfiguration} object is never returned by the
389+ * service: after the instance is created the corresponding attached disk will be returned with a
390+ * {@link PersistentDiskConfiguration}.
389391 */
390392 public static final class CreateDiskConfiguration extends AttachedDiskConfiguration {
391393
@@ -407,7 +409,9 @@ public static final class Builder {
407409 private ImageId sourceImage ;
408410 private Boolean autoDelete ;
409411
410- private Builder () {}
412+ private Builder (ImageId sourceImage ) {
413+ this .sourceImage = checkNotNull (sourceImage );
414+ }
411415
412416 private Builder (CreateDiskConfiguration configuration ) {
413417 this .diskName = configuration .diskName ;
@@ -474,7 +478,7 @@ public CreateDiskConfiguration build() {
474478 this .diskName = builder .diskName ;
475479 this .diskType = builder .diskType ;
476480 this .diskSizeGb = builder .diskSizeGb ;
477- this .sourceImage = checkNotNull ( builder .sourceImage ) ;
481+ this .sourceImage = builder .sourceImage ;
478482 }
479483
480484 /**
@@ -568,7 +572,7 @@ com.google.api.services.compute.model.AttachedDisk toPb() {
568572 * will be used to create the disk.
569573 */
570574 public static Builder builder (ImageId sourceImage ) {
571- return new Builder (). sourceImage ( sourceImage );
575+ return new Builder (sourceImage );
572576 }
573577
574578 /**
@@ -623,7 +627,7 @@ private Builder(ScratchDiskConfiguration configuration) {
623627 }
624628
625629 /**
626- * Sets the identity of the disk type.
630+ * Sets the identity of the disk type for the scratch disk to attach .
627631 */
628632 public Builder diskType (DiskTypeId diskType ) {
629633 this .diskType = diskType ;
@@ -827,7 +831,7 @@ public Integer index() {
827831 }
828832
829833 /**
830- * Sets the attached disk configuration. Returns {@link ScratchDiskConfiguration} to attach a
834+ * Returns the attached disk configuration. Returns {@link ScratchDiskConfiguration} to attach a
831835 * scratch disk to the instance. Returns {@link PersistentDiskConfiguration} to attach a
832836 * persistent disk to the instance. Returns {@link CreateDiskConfiguration} to create and attach
833837 * a new persistent disk.
@@ -903,7 +907,7 @@ public static AttachedDisk of(AttachedDiskConfiguration configuration) {
903907 }
904908
905909 /**
906- * Returns an {@code AttachedDisk} object given its configuration and the device name.
910+ * Returns an {@code AttachedDisk} object given the device name and its configuration .
907911 */
908912 public static AttachedDisk of (String deviceName , AttachedDiskConfiguration configuration ) {
909913 return builder (configuration ).deviceName (deviceName ).build ();
0 commit comments