public Disk build() { return new Disk(super.id, super.creationTimestamp, super.selfLink, super.name, super.description, super.sizeGb, zone, super.status); }
@Override public Optional<Image> load(URI key) throws ExecutionException { try { Image image = null; Disk disk = resources.disk(key); if (disk != null && disk.sourceImage() != null) { image = resources.image(disk.sourceImage()); } return Optional.fromNullable(image); } catch (Exception e) { throw new ExecutionException(message(key, e), e); } }
/** * {@inheritDoc} */ @Override public String toString() { return string().toString(); }
public Builder fromDisk(Disk in) { return super.fromAbstractDisk(in) .zone(in.getZone()); }
bootDisk.getSelfLink(), null, true,
private static Disk disk(URI sourceImage) { return Disk.create( // "13050421646334304115", // id new Date(), // creationTimestamp URI.create("http://localhost/zone"), // zone Status.READY, // status "testimage1", // name null, // description 1, // sizeGb null, // sourceSnapshot null, // sourceSnapshotId DISK_URI, // selfLink sourceImage, // sourceImage null, // sourceImageId URI.create("http://localhost/type"), // type null // license ); }
@Test(groups = "live") public void testInsertDisk() { assertOperationDoneSuccessfully(diskApi().create(DISK_NAME, new DiskCreationOptions.Builder().sizeGb(sizeGb).build())); Disk disk = diskApi().get(DISK_NAME); diskURI = disk.selfLink(); }
public void testCreatePreemptibleNodeWithSsd() throws Exception { String group = this.group + "ssd"; try { TemplateOptions options = client.templateOptions(); options.as(GoogleComputeEngineTemplateOptions.class).bootDiskType("pd-ssd").preemptible(true); // create a node Set<? extends NodeMetadata> nodes = client.createNodesInGroup(group, 1, options); assertEquals(nodes.size(), 1, "One node should have been created"); // Verify the disk on the instance is an ssd. NodeMetadata node = Iterables.get(nodes, 0); GoogleComputeEngineApi api = client.getContext().unwrapApi(GoogleComputeEngineApi.class); Instance instance = api.instancesInZone(node.getLocation().getId()).get(node.getName()); Disk disk = api.disksInZone(node.getLocation().getId()).get(toName(instance.disks().get(0).source())); assertTrue(disk.type().toString().endsWith("pd-ssd")); assertTrue(instance.scheduling().preemptible()); } finally { client.destroyNodesMatching(inGroup(group)); } } /**
public Builder fromDisk(Disk in) { return super.fromAbstractDisk(in) .zone(in.getZone()); }
bootDisk.getSelfLink(), null, true,
@Consumes(APPLICATION_JSON) public Disk expected(String baseUrl){ return Disk.create( // "13050421646334304115", // id parse("2012-11-25T01:38:48.306"), // creationTimestamp URI.create(baseUrl + "/party/zones/us-central1-a"), // zone Status.READY, // status "testimage1", // name null, // description 1, // sizeGb null, // sourceSnapshot null, // sourceSnapshotId URI.create(baseUrl + "/party/zones/us-central1-a/disks/testimage1"), // selfLink null, // sourceImage null, // sourceImageId URI.create(baseUrl + "/studied-point-720/zones/us-central1-a/diskTypes/pd-standard"), // type null // license ); } }
@Override public Optional<Image> load(URI key) throws ExecutionException { try { Image image = null; Disk disk = resources.disk(key); if (disk != null && disk.sourceImage() != null) { image = resources.image(disk.sourceImage()); } return Optional.fromNullable(image); } catch (Exception e) { throw new ExecutionException(message(key, e), e); } }
public Disk build() { return new Disk(super.id, super.creationTimestamp, super.selfLink, super.name, super.description, super.sizeGb, zone, super.status); }
/** * {@inheritDoc} */ @Override public String toString() { return string().toString(); }
@Override public Image load(URI key) throws ExecutionException { try { Disk disk = resources.disk(key); return resources.image(disk.sourceImage()); } catch (Exception e) { throw new ExecutionException(message(key, e), e); } }