public static NewInstance create(String name, URI machineType, URI network, List<AttachDisk> disks, String description) { return create(name, machineType, network, disks, description, null); }
/** Convenience for creating a new instance with only a boot disk and minimal parameters. */ public static NewInstance create(String name, URI machineType, URI network, URI subnetwork, URI sourceImage) { return create(name, machineType, network, subnetwork, Arrays.asList(AttachDisk.newBootDisk(sourceImage)), null, null); }
/** Convenience for creating a new instance with only a boot disk and minimal parameters. */ public static NewInstance create(String name, URI machineType, URI network, URI subnetwork, URI sourceImage) { return create(name, machineType, network, subnetwork, Arrays.asList(AttachDisk.newBootDisk(sourceImage)), null, null); }
/** Convenience for creating a new instance with only a boot disk and minimal parameters. */ public static NewInstance create(String name, URI machineType, URI network, URI sourceImage) { return create(name, machineType, network, Arrays.asList(AttachDisk.newBootDisk(sourceImage)), null); }
/** Convenience for creating a new instance with only a boot disk and minimal parameters. */ public static NewInstance create(String name, URI machineType, URI network, URI sourceImage) { return create(name, machineType, network, Arrays.asList(AttachDisk.newBootDisk(sourceImage)), null, null); }
public static NewInstance create(String name, URI machineType, URI network, @Nullable URI subnetwork, List<AttachDisk> disks, @Nullable String description, @Nullable Tags tags) { checkArgument(disks.get(0).boot(), "disk 0 must be a boot disk! %s", disks); boolean foundBoot = false; for (AttachDisk disk : disks) { if (disk.boot()) { checkArgument(!foundBoot, "There must be only one boot disk! %s", disks); foundBoot = true; } } return create(name, machineType, null, ImmutableList.of(NetworkInterface.create(network, subnetwork)), ImmutableList.copyOf(disks), description, tags != null ? tags : Tags.create(), Metadata.create(), null, null); }
public NewInstance build() { return create(name, machineType, canIpForward, networkInterfaces, disks, description, tags != null ? tags : Tags.create(), metadata != null ? metadata : Metadata.create(), serviceAccounts, scheduling); } }
public static NewInstance create(String name, URI machineType, URI network, @Nullable URI subnetwork, List<AttachDisk> disks, @Nullable String description, @Nullable Tags tags) { checkArgument(disks.get(0).boot(), "disk 0 must be a boot disk! %s", disks); boolean foundBoot = false; for (AttachDisk disk : disks) { if (disk.boot()) { checkArgument(!foundBoot, "There must be only one boot disk! %s", disks); foundBoot = true; } } return create(name, machineType, null, ImmutableList.of(NetworkInterface.create(network, subnetwork)), ImmutableList.copyOf(disks), description, tags != null ? tags : Tags.create(), Metadata.create(), null, null); }
public NewInstance build() { return create(name, machineType, canIpForward, networkInterfaces, disks, description, tags != null ? tags : Tags.create(), metadata != null ? metadata : Metadata.create(), serviceAccounts, scheduling); } }
public static NewInstance create(String name, URI machineType, URI network, List<AttachDisk> disks, @Nullable String description, @Nullable Tags tags) { checkArgument(disks.get(0).boot(), "disk 0 must be a boot disk! %s", disks); boolean foundBoot = false; for (AttachDisk disk : disks) { if (disk.boot()) { checkArgument(!foundBoot, "There must be only one boot disk! %s", disks); foundBoot = true; } } return create(name, machineType, null, ImmutableList.of(NetworkInterface.create(network)), ImmutableList.copyOf(disks), description, tags != null ? tags : Tags.create(), Metadata.create(), null, null); }
public NewInstance build() { return create(name, machineType, canIpForward, networkInterfaces, disks, description, tags != null ? tags : Tags.create(), metadata != null ? metadata : Metadata.create(), serviceAccounts, scheduling); } }
public static NewInstance create(String name, URI machineType, URI network, List<AttachDisk> disks, String description, Scheduling scheduling) { checkArgument(disks.get(0).boot(), "disk 0 must be a boot disk! %s", disks); boolean foundBoot = false; for (AttachDisk disk : disks) { if (disk.boot()) { checkArgument(!foundBoot, "There must be only one boot disk! %s", disks); foundBoot = true; } } return create(name, machineType, null, ImmutableList.of(NetworkInterface.create(network)), ImmutableList.copyOf(disks), description, Tags.create(), Metadata.create(), null, scheduling); }
@Override protected GoogleComputeEngineApi create(Properties props, Iterable<Module> modules) { GoogleComputeEngineApi api = super.create(props, modules); reset_windows_password = injector.getInstance(Key.get(new TypeLiteral<Function<Map<String, ?>, String>>() {})); List<Image> list = api.images().listInProject("windows-cloud", filter("name eq windows-server-2012.*")).next(); URI imageUri = FluentIterable.from(list) .filter(new Predicate<Image>() { @Override public boolean apply(Image input) { // filter out all deprecated images return !(input.deprecated() != null && input.deprecated().state() != null); } }) .first() .get() .selfLink(); instance = NewInstance.create( INSTANCE_NAME, getDefaultMachineTypeUrl(), getNetworkUrl(INSTANCE_NETWORK_NAME), null, imageUri ); return api; }
public void insert_noOptions() throws Exception { server.enqueue(jsonResponse("/zone_operation.json")); NewInstance newInstance = NewInstance.create( "test-1", // name URI.create(url("/projects/party/zones/us-central1-a/machineTypes/n1-standard-1")), // machineType URI.create(url("/projects/party/global/networks/default")), // network null, // subnetwork URI.create(url("/projects/party/global/images/centos-6-2-v20120326")) // sourceImage ); assertEquals(instanceApi().create(newInstance), new ParseZoneOperationTest().expected(url("/projects"))); assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances", stringFromResource("/instance_insert_simple.json")); }
NewInstance newInstance = NewInstance.create(
public void insert_allOptions() throws Exception { server.enqueue(jsonResponse("/zone_operation.json")); NewInstance newInstance = NewInstance.create( "test-1", // name URI.create(url("/projects/party/zones/us-central1-a/machineTypes/n1-standard-1")), // machineType URI.create(url("/projects/party/global/networks/default")), // network null, // subnetwork Arrays.asList(AttachDisk.existingBootDisk(URI.create(url("/projects/party/zones/us-central1-a/disks/test")))), "desc", // description null // tags ); newInstance.metadata().put("aKey", "aValue"); assertEquals(instanceApi().create(newInstance), new ParseZoneOperationTest().expected(url("/projects"))); assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances", stringFromResource("/instance_insert.json")); }
@Override protected GoogleComputeEngineApi create(Properties props, Iterable<Module> modules) { GoogleComputeEngineApi api = super.create(props, modules); List<Image> list = api.images().listInProject("centos-cloud", filter("name eq centos.*")).next(); URI imageUri = FluentIterable.from(list) .filter(new Predicate<Image>() { @Override public boolean apply(Image input) { // filter out all deprecated images return !(input.deprecated() != null && input.deprecated().state() != null); } }) .first() .get() .selfLink(); NewInstance newInstance = NewInstance.create( INSTANCE_NAME, // name getDefaultMachineTypeUrl(), // machineType getNetworkUrl(INSTANCE_NETWORK_NAME), // network null, // subnetwork imageUri); // need to insert the network first assertOperationDoneSuccessfully(api.networks().createLegacy(INSTANCE_NETWORK_NAME, IPV4_RANGE)); assertOperationDoneSuccessfully(api.instancesInZone(DEFAULT_ZONE_NAME).create(newInstance)); instance = api.instancesInZone(DEFAULT_ZONE_NAME).get(INSTANCE_NAME); assertNotNull(instance); return api; }
.selfLink(); instance = NewInstance.create(
instanceApi.create(NewInstance.create( //