Updates to InstanceApi. 100% coverage

This commit is contained in:
Daniel Broudy 2014-12-04 15:29:21 -08:00 committed by Ignasi Barrera
parent fd27ab1a9a
commit 94d42c3c6c
13 changed files with 271 additions and 126 deletions

View File

@ -153,6 +153,7 @@ public final class GoogleComputeEngineServiceAdapter
// We need to see the created instance so that we can access the newly created disk.
AtomicReference<Instance> instance = Atomics.newReference(Instance.create( //
"0000000000000000000", // id can't be null, but isn't available until provisioning is done.
null, // creationTimestamp
create.targetLink(), // selfLink
newInstance.name(), // name
newInstance.description(), // description
@ -161,6 +162,7 @@ public final class GoogleComputeEngineServiceAdapter
Instance.Status.PROVISIONING, // status
null, // statusMessage
create.zone(), // zone
null, // canIpForward
null, // networkInterfaces
null, // disks
newInstance.metadata(), // metadata

View File

@ -17,6 +17,7 @@
package org.jclouds.googlecomputeengine.domain;
import java.net.URI;
import java.util.List;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
@ -26,7 +27,7 @@ import com.google.auto.value.AutoValue;
@AutoValue
public abstract class AttachDisk {
@AutoValue
abstract static class InitializeParams {
public abstract static class InitializeParams {
/** Override the default naming convention. */
@Nullable public abstract String diskName();
@ -36,13 +37,15 @@ public abstract class AttachDisk {
/** The {@link org.jclouds.googlecomputeengine.domain.Image#selfLink() source image}. */
public abstract URI sourceImage();
@Nullable public abstract String diskType();
static InitializeParams create(URI sourceImage) {
return create(null, null, sourceImage);
return create(null, null, sourceImage, null);
}
@SerializedNames({ "diskName", "diskSizeGb", "sourceImage" })
static InitializeParams create(String diskName, Long diskSizeGb, URI sourceImage) {
return new AutoValue_AttachDisk_InitializeParams(diskName, diskSizeGb, sourceImage);
@SerializedNames({ "diskName", "diskSizeGb", "sourceImage", "diskType" })
public static InitializeParams create(String diskName, Long diskSizeGb, URI sourceImage, String diskType) {
return new AutoValue_AttachDisk_InitializeParams(diskName, diskSizeGb, sourceImage, diskType);
}
InitializeParams() {
@ -59,6 +62,11 @@ public abstract class AttachDisk {
READ_ONLY;
}
public enum DiskInterface {
NVME,
SCSI;
}
public abstract Type type();
@Nullable public abstract Mode mode();
@ -82,6 +90,11 @@ public abstract class AttachDisk {
/** True if this disk will be deleted when the instance is delete. */
public abstract boolean autoDelete();
@Nullable public abstract List<String> licenses();
// Note: this is disks[].interface in the api docs but interface is a Java keyword.
@Nullable public abstract DiskInterface diskInterface();
public static AttachDisk existingBootDisk(URI existingBootDisk) {
return create(Type.PERSISTENT, existingBootDisk, null, true, false);
}
@ -96,13 +109,13 @@ public abstract class AttachDisk {
static AttachDisk create(Type type, URI source, InitializeParams initializeParams, boolean boot,
boolean autoDelete) {
return create(type, null, source, null, boot, initializeParams, autoDelete);
return create(type, null, source, null, boot, initializeParams, autoDelete, null, null);
}
@SerializedNames({"type", "mode", "source", "deviceName", "boot", "initializeParams", "autoDelete" })
@SerializedNames({"type", "mode", "source", "deviceName", "boot", "initializeParams", "autoDelete", "licenses", "interface" })
public static AttachDisk create(Type type, Mode mode, URI source, String deviceName, boolean boot, InitializeParams initializeParams,
boolean autoDelete) {
return new AutoValue_AttachDisk(type, mode, source, deviceName, boot, initializeParams, autoDelete);
boolean autoDelete, List<String> licenses, DiskInterface diskInterface) {
return new AutoValue_AttachDisk(type, mode, source, deviceName, boot, initializeParams, autoDelete, licenses, diskInterface);
}
AttachDisk() {

View File

@ -19,8 +19,11 @@ package org.jclouds.googlecomputeengine.domain;
import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
import java.net.URI;
import java.util.Date;
import java.util.List;
import org.jclouds.googlecomputeengine.domain.AttachDisk.DiskInterface;
import org.jclouds.googlecomputeengine.domain.AttachDisk.InitializeParams;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
@ -63,10 +66,20 @@ public abstract class Instance {
public abstract boolean boot();
@SerializedNames({ "index", "type", "mode", "source", "deviceName", "autoDelete", "boot" })
@Nullable public abstract InitializeParams initializeParams();
@Nullable public abstract List<String> licenses();
// Note: this is disks[].interface in the api docs but interface is a Java keyword.
@Nullable public abstract DiskInterface diskInterface();
@SerializedNames({ "index", "type", "mode", "source", "deviceName", "autoDelete", "boot",
"initializeParams", "licenses", "interface" })
public static AttachedDisk create(int index, Type type, Mode mode, URI source, String deviceName,
boolean autoDelete, boolean boot) {
return new AutoValue_Instance_AttachedDisk(index, type, mode, source, deviceName, autoDelete, boot);
boolean autoDelete, boolean boot, InitializeParams initializeParams,
List<String> licenses, DiskInterface diskInterface) {
return new AutoValue_Instance_AttachedDisk(index, type, mode, source, deviceName, autoDelete,
boot, initializeParams, licenses, diskInterface);
}
AttachedDisk() {
@ -124,7 +137,7 @@ public abstract class Instance {
@AutoValue
public abstract static class SerialPortOutput {
@Nullable public abstract URI selfLink(); // TODO: is this really nullable?!
public abstract URI selfLink();
/** The contents of the console output. */
public abstract String contents();
@ -200,6 +213,8 @@ public abstract class Instance {
public abstract String id();
@Nullable public abstract Date creationTimestamp();
public abstract URI selfLink();
public abstract String name();
@ -221,6 +236,8 @@ public abstract class Instance {
*/
public abstract URI zone();
@Nullable public abstract Boolean canIpForward();
public abstract List<NetworkInterface> networkInterfaces();
public abstract List<AttachedDisk> disks();
@ -231,13 +248,13 @@ public abstract class Instance {
public abstract Scheduling scheduling();
@SerializedNames({ "id", "selfLink", "name", "description", "tags", "machineType", "status", "statusMessage", "zone",
"networkInterfaces", "disks", "metadata", "serviceAccounts", "scheduling"})
public static Instance create(String id, URI selfLink, String name, String description, Tags tags, URI machineType,
Status status, String statusMessage, URI zone, List<NetworkInterface> networkInterfaces,
@SerializedNames({ "id", "creationTimestamp", "selfLink", "name", "description", "tags", "machineType", "status", "statusMessage", "zone",
"canIpForward", "networkInterfaces", "disks", "metadata", "serviceAccounts", "scheduling"})
public static Instance create(String id, Date creationTimestamp, URI selfLink, String name, String description, Tags tags, URI machineType,
Status status, String statusMessage, URI zone, Boolean canIpForward, List<NetworkInterface> networkInterfaces,
List<AttachedDisk> disks, Metadata metadata, List<ServiceAccount> serviceAccounts, Scheduling scheduling) {
return new AutoValue_Instance(id, selfLink, name, description, tags, machineType, status, statusMessage, zone,
copyOf(networkInterfaces), copyOf(disks), metadata, copyOf(serviceAccounts), scheduling);
return new AutoValue_Instance(id, creationTimestamp, selfLink, name, description, tags, machineType, status, statusMessage, zone,
canIpForward, copyOf(networkInterfaces), copyOf(disks), metadata, copyOf(serviceAccounts), scheduling);
}
Instance() {

View File

@ -24,6 +24,7 @@ import java.util.List;
import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig;
import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
import org.jclouds.googlecomputeengine.domain.Instance.ServiceAccount;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
@ -56,6 +57,8 @@ public abstract class NewInstance {
public abstract URI machineType();
@Nullable public abstract Boolean canIpForward();
public abstract List<NetworkInterface> networkInterfaces();
public abstract List<AttachDisk> disks();
@ -67,6 +70,8 @@ public abstract class NewInstance {
/** Add metadata via {@link Metadata#items()}. */
public abstract Metadata metadata();
@Nullable public abstract List<ServiceAccount> serviceAccounts();
@Nullable public abstract Scheduling scheduling();
/** Convenience for creating a new instance with only a boot disk and minimal parameters. */
@ -83,14 +88,15 @@ public abstract class NewInstance {
foundBoot = true;
}
}
return create(name, machineType, ImmutableList.of(NetworkInterface.create(network)), ImmutableList.copyOf(disks),
description, Tags.create(), Metadata.create(), null);
return create(name, machineType, null, ImmutableList.of(NetworkInterface.create(network)), ImmutableList.copyOf(disks),
description, Tags.create(), Metadata.create(), null, null);
}
@SerializedNames({ "name", "machineType", "networkInterfaces", "disks", "description", "tags", "metadata", "scheduling" })
static NewInstance create(String name, URI machineType, List<NetworkInterface> networkInterfaces,
List<AttachDisk> disks, String description, Tags tags, Metadata metadata, Scheduling scheduling) {
return new AutoValue_NewInstance(name, machineType, networkInterfaces, disks, description, tags, metadata, scheduling);
@SerializedNames({ "name", "machineType", "canIpForward", "networkInterfaces", "disks", "description", "tags", "metadata",
"serviceAccounts", "scheduling" })
static NewInstance create(String name, URI machineType, Boolean canIpForward, List<NetworkInterface> networkInterfaces,
List<AttachDisk> disks, String description, Tags tags, Metadata metadata, List<ServiceAccount> serviceAccounts, Scheduling scheduling) {
return new AutoValue_NewInstance(name, machineType, canIpForward, networkInterfaces, disks, description, tags, metadata, serviceAccounts, scheduling);
}
NewInstance() {

View File

@ -107,7 +107,7 @@ public interface InstanceApi {
Operation addAccessConfigToNic(@PathParam("instance") String instance,
@BinderParam(BindToJsonPayload.class)
AccessConfig accessConfig,
@QueryParam("network_interface") String networkInterfaceName);
@QueryParam("networkInterface") String networkInterfaceName);
/**
* Deletes an access config from an instance's network interface.
@ -122,8 +122,8 @@ public interface InstanceApi {
@DELETE
@Path("/{instance}/deleteAccessConfig")
Operation deleteAccessConfigFromNic(@PathParam("instance") String instance,
@QueryParam("access_config") String accessConfigName,
@QueryParam("network_interface") String networkInterfaceName);
@QueryParam("accessConfig") String accessConfigName,
@QueryParam("networkInterface") String networkInterfaceName);
/**
* Returns the specified instance's serial port output.
@ -131,7 +131,7 @@ public interface InstanceApi {
* @param instance the instance name.
* @return if successful, this method returns a SerialPortOutput containing the instance's serial output.
*/
@Named("Instances:serialPort")
@Named("Instances:getSerialPortOutput")
@GET
@Path("/{instance}/serialPort")
SerialPortOutput getSerialPortOutput(@PathParam("instance") String instance);

View File

@ -33,6 +33,7 @@ import org.jclouds.googlecomputeengine.domain.Image;
import org.jclouds.googlecomputeengine.domain.Instance;
import org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk;
import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
import org.jclouds.googlecomputeengine.domain.Instance.SerialPortOutput;
import org.jclouds.googlecomputeengine.domain.Metadata;
import org.jclouds.googlecomputeengine.domain.NewInstance;
import org.jclouds.googlecomputeengine.domain.AttachDisk;
@ -121,6 +122,14 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
assertInstanceEquals(instance, this.instance);
}
@Test(groups = "live", dependsOnMethods = "testInsertInstance")
public void testGetSerialPortOutput() {
SerialPortOutput output = api().getSerialPortOutput(INSTANCE_NAME);
assertNotNull(output);
assertNotNull(output.selfLink());
assertNotNull(output.contents());
}
@Test(groups = "live", dependsOnMethods = "testInsertInstance")
public void testSetDiskAutoDelete() {
@ -196,13 +205,16 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
Instance originalInstance = api().get(INSTANCE_NAME);
assertOperationDoneSuccessfully(api().attachDisk(INSTANCE_NAME,
AttachDisk.create(AttachDisk.Type.PERSISTENT,
AttachDisk.Mode.READ_ONLY,
getDiskUrl(ATTACH_DISK_NAME),
ATTACH_DISK_DEVICE_NAME,
false,
null,
false)));
AttachDisk.create(AttachDisk.Type.PERSISTENT, // type
AttachDisk.Mode.READ_ONLY, // mode
getDiskUrl(ATTACH_DISK_NAME), // source
ATTACH_DISK_DEVICE_NAME, // deviceName
false, // boot
null, // initializeParams
false, // autoDelete
null, // licenses
null // interface
)));
Instance modifiedInstance = api().get(INSTANCE_NAME);
@ -246,7 +258,7 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
assertOperationDoneSuccessfully(api().reset(INSTANCE_NAME));
}
@Test(groups = "live", dependsOnMethods = {"testSetDiskAutoDelete", "testResetInstance", "testSetScheduling"}, alwaysRun = true)
@Test(groups = "live", dependsOnMethods = {"testSetDiskAutoDelete", "testResetInstance", "testSetScheduling", "testGetInstance", "testGetSerialPortOutput"}, alwaysRun = true)
public void testDeleteInstance() {
assertOperationDoneSuccessfully(api().delete(INSTANCE_NAME));
assertOperationDoneSuccessfully(diskApi().delete(DISK_NAME));

View File

@ -24,6 +24,9 @@ import java.net.URI;
import java.util.Arrays;
import org.jclouds.googlecomputeengine.domain.AttachDisk;
import org.jclouds.googlecomputeengine.domain.AttachDisk.DiskInterface;
import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig;
import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig.Type;
import org.jclouds.googlecomputeengine.domain.Metadata;
import org.jclouds.googlecomputeengine.domain.NewInstance;
import org.jclouds.googlecomputeengine.domain.Instance.Scheduling.OnHostMaintenance;
@ -42,8 +45,8 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
public void get() throws Exception {
server.enqueue(jsonResponse("/instance_get.json"));
assertEquals(instanceApi().get("test-1"), new ParseInstanceTest().expected(url("/projects")));
assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-1");
assertEquals(instanceApi().get("test-instance"), new ParseInstanceTest().expected(url("/projects")));
assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-instance");
}
public void get_4xx() throws Exception {
@ -57,7 +60,7 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
server.enqueue(jsonResponse("/instance_serial_port.json"));
assertEquals(instanceApi().getSerialPortOutput("test-1"),
new ParseInstanceSerialOutputTest().expected());
new ParseInstanceSerialOutputTest().expected(url("/projects")));
assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-1/serialPort");
}
@ -94,6 +97,32 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
stringFromResource("/instance_insert.json"));
}
public void addAccessConfig() throws Exception {
server.enqueue(jsonResponse("/zone_operation.json"));
AccessConfig config = AccessConfig.create("test-access", Type.ONE_TO_ONE_NAT, "1.1.1.1");
assertEquals(instanceApi().addAccessConfigToNic("test-instance", config, "test-network"),
new ParseZoneOperationTest().expected(url("/projects")));
assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-instance/"
+ "addAccessConfig?networkInterface=test-network",
"{" +
" \"type\": \"ONE_TO_ONE_NAT\"," +
" \"name\": \"test-access\"," +
" \"natIP\": \"1.1.1.1\"" +
"}");
}
public void deleteAccessConfig() throws Exception {
server.enqueue(jsonResponse("/zone_operation.json"));
assertEquals(instanceApi().deleteAccessConfigFromNic("test-instance", "test-access", "test-network"),
new ParseZoneOperationTest().expected(url("/projects")));
assertSent(server, "DELETE", "/projects/party/zones/us-central1-a/instances/test-instance/"
+ "deleteAccessConfig?accessConfig=test-access&networkInterface=test-network");
}
public void delete() throws Exception {
server.enqueue(jsonResponse("/zone_operation.json"));
@ -154,10 +183,21 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
server.enqueue(jsonResponse("/zone_operation.json"));
assertEquals(instanceApi().attachDisk("test-1",
AttachDisk.create(AttachDisk.Type.PERSISTENT,
AttachDisk.Mode.READ_ONLY,
URI.create(url("/projects/party/zones/us-central1-a/disks/testimage1")),
null, false, null, true)),
AttachDisk.create(AttachDisk.Type.PERSISTENT, // type
AttachDisk.Mode.READ_WRITE, // mode
URI.create(url("/projects/party/zones/us-central1-a/disks/test")), // source
"test", // deviceName
true, // boot
AttachDisk.InitializeParams.create(
"test", // diskName
Long.parseLong("100", 10), // diskSizeGb
URI.create(url("/projects/party/global/images/test")), // sourceImage
"pd-standard" // diskType
), // initializeParams
true, // autoDelete
ImmutableList.of(url("/projects/suse-cloud/global/licenses/sles-12")), // licenses
DiskInterface.NVME // interface
)),
new ParseZoneOperationTest().expected(url("/projects")));
assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-1/attachDisk",
stringFromResource("/instance_attach_disk.json"));

View File

@ -19,6 +19,8 @@ package org.jclouds.googlecomputeengine.parse;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.domain.Instance.SerialPortOutput;
import java.net.URI;
import javax.ws.rs.Consumes;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
@ -34,6 +36,13 @@ public class ParseInstanceSerialOutputTest extends BaseGoogleComputeEngineParseT
@Override @Consumes(APPLICATION_JSON)
public SerialPortOutput expected() {
return SerialPortOutput.create(null, "console output");
return expected(BASE_URL);
}
@Consumes(APPLICATION_JSON)
public SerialPortOutput expected(String baseUrl) {
return SerialPortOutput.create(
URI.create(baseUrl + "/party/zones/us-central1-a/instances/test-instance/serialPort"),
"console output");
}
}

View File

@ -22,6 +22,8 @@ import java.net.URI;
import javax.ws.rs.Consumes;
import org.jclouds.googlecomputeengine.domain.AttachDisk;
import org.jclouds.googlecomputeengine.domain.AttachDisk.DiskInterface;
import org.jclouds.googlecomputeengine.domain.Instance;
import org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk;
import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface;
@ -51,6 +53,7 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
public Instance expected(String baseUrl) {
return Instance.create( //
"13051190678907570425", // id
parse("2012-11-25T23:48:20.758"), // creationTimestamp
URI.create(baseUrl + "/party/zones/us-central1-a/instances/test-0"), // selfLink
"test-0", // name
"desc", // description
@ -59,6 +62,7 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
Instance.Status.RUNNING, // status
null, // statusMessage
URI.create(baseUrl + "/party/zones/us-central1-a"), // zone
true, // canIpForward
ImmutableList.of(NetworkInterface.create( //
"nic0", // name
URI.create(baseUrl + "/party/global/networks/default"), // network
@ -72,7 +76,15 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
URI.create(baseUrl + "/party/zones/us-central1-a/disks/test"), // source
"test", // deviceName
false, // autoDelete
true// boot
true, // boot
AttachDisk.InitializeParams.create(
"test", // diskName
Long.parseLong("100", 10), // diskSizeGb
URI.create(baseUrl + "/party/global/images/test"), // sourceImage
"pd-standard" // diskType
), // initializeParams
ImmutableList.of(baseUrl + "/suse-cloud/global/licenses/sles-12"), // licenses
DiskInterface.NVME // interface
)), // disks
Metadata.create("efgh")
.put("aKey", "aValue")

View File

@ -1,7 +1,18 @@
{
"type": "PERSISTENT",
"mode": "READ_ONLY",
"source": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disks/testimage1",
"boot": false,
"autoDelete": true
"type": "PERSISTENT",
"mode": "READ_WRITE",
"deviceName": "test",
"source": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disks/test",
"boot": true,
"autoDelete": true,
"initializeParams": {
"diskName": "test",
"sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test",
"diskSizeGb": 100,
"diskType": "pd-standard"
},
"licenses": [
"https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"
],
"interface": "NVME"
}

View File

@ -7,6 +7,7 @@
"name": "test-0",
"machineType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/machineTypes/n1-standard-1",
"status": "RUNNING",
"canIpForward": true,
"zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a",
"networkInterfaces": [
{
@ -24,7 +25,17 @@
"deviceName": "test",
"source": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disks/test",
"index": 0,
"boot": true
"boot": true,
"initializeParams": {
"diskName": "test",
"sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test",
"diskSizeGb": "100",
"diskType": "pd-standard"
},
"licenses": [
"https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"
],
"interface": "NVME"
}
],
"serviceAccounts": [

View File

@ -1,74 +1,85 @@
{
"kind": "compute#instanceList",
"id": "projects/party/zones/us-central1-a/instances",
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances",
"items": [
{
"kind": "compute#instance",
"id": "13051190678907570425",
"description": "desc",
"creationTimestamp": "2012-11-25T23:48:20.758",
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-0",
"name": "test-0",
"machineType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/machineTypes/n1-standard-1",
"status": "RUNNING",
"zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a",
"networkInterfaces": [
{
"kind": "compute#instanceNetworkInterface",
"name": "nic0",
"networkIP": "10.240.121.115",
"network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default"
}
],
"disks": [
{
"kind": "compute#instanceDisk",
"type": "PERSISTENT",
"mode": "READ_WRITE",
"deviceName": "test",
"source": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disks/test",
"index": 0,
"boot": true
}
],
"serviceAccounts": [
{
"kind": "compute#serviceAccount",
"email": "default",
"scopes": [
"myscope"
]
}
],
"metadata": {
"items": [
{
"key": "aKey",
"value": "aValue"
},
{
"key": "jclouds-image",
"value": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718"
},
{
"key": "jclouds-delete-boot-disk",
"value": "true"
}
],
"fingerprint": "efgh"
},
"tags": {
"items": [
"aTag",
"Group-port-42"
],
"fingerprint": "abcd"
},
"scheduling": {
"onHostMaintenance": "MIGRATE",
"automaticRestart": false
}
"kind": "compute#instanceList",
"id": "projects/party/zones/us-central1-a/instances",
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances",
"items": [
{
"kind": "compute#instance",
"id": "13051190678907570425",
"description": "desc",
"creationTimestamp": "2012-11-25T23:48:20.758",
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-0",
"name": "test-0",
"machineType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/machineTypes/n1-standard-1",
"status": "RUNNING",
"canIpForward": true,
"zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a",
"networkInterfaces": [
{
"kind": "compute#instanceNetworkInterface",
"name": "nic0",
"networkIP": "10.240.121.115",
"network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default"
}
],
"disks": [
{
"kind": "compute#instanceDisk",
"type": "PERSISTENT",
"mode": "READ_WRITE",
"deviceName": "test",
"source": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disks/test",
"index": 0,
"boot": true,
"initializeParams": {
"diskName": "test",
"sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test",
"diskSizeGb": "100",
"diskType": "pd-standard"
},
"licenses": [
"https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"
],
"interface": "NVME"
}
],
"serviceAccounts": [
{
"kind": "compute#serviceAccount",
"email": "default",
"scopes": [
"myscope"
]
}
],
"metadata": {
"items": [
{
"key": "aKey",
"value": "aValue"
},
{
"key": "jclouds-image",
"value": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718"
},
{
"key": "jclouds-delete-boot-disk",
"value": "true"
}
],
"fingerprint": "efgh"
},
"tags": {
"items": [
"aTag",
"Group-port-42"
],
"fingerprint": "abcd"
},
"scheduling": {
"onHostMaintenance": "MIGRATE",
"automaticRestart": false
}
]
}
}
]
}

View File

@ -1,4 +1,5 @@
{
"kind": "compute#serialPortOutput",
"contents": "console output"
"kind": "compute#serialPortOutput",
"contents": "console output",
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-instance/serialPort"
}