DISK_CONFIGURATION .toBuilder() .setDiskType(DiskTypeId.of(TYPE.getZone(), TYPE.getType())) .build(); DiskInfo diskInfo =
/** Returns a {@code StandardDiskConfiguration} object given the disk type. */ public static StandardDiskConfiguration of(DiskTypeId diskType) { return newBuilder().setDiskType(diskType).build(); }
/** Returns a {@code StandardDiskConfiguration} object given the disk type and size in GB. */ public static StandardDiskConfiguration of(DiskTypeId diskType, long sizeGb) { return newBuilder().setDiskType(diskType).setSizeGb(sizeGb).build(); }
@Override StandardDiskConfiguration setProjectId(String projectId) { if (getDiskType() == null || getDiskType().getProject() != null) { return this; } return toBuilder().setDiskType(getDiskType().setProjectId(projectId)).build(); }
@Test public void testSetProjectId() { StandardDiskConfiguration configuration = DISK_CONFIGURATION .toBuilder() .setDiskType(DiskTypeId.of(DISK_TYPE.getZone(), DISK_TYPE.getType())) .build(); compareStandardDiskConfiguration(DISK_CONFIGURATION, configuration.setProjectId("project")); }