JCLOUDS-935. Move AttachDisk.InitializeParams to URI for diskType

Note that two tests are failing right now with or without this.
This commit is contained in:
Andrew Bayer 2015-06-11 14:07:24 -07:00
parent 012e1885e5
commit 6d850a8aee
6 changed files with 10 additions and 12 deletions

View File

@ -37,14 +37,14 @@ public abstract class AttachDisk {
/** The {@link org.jclouds.googlecomputeengine.domain.Image#selfLink() source image}. */ /** The {@link org.jclouds.googlecomputeengine.domain.Image#selfLink() source image}. */
public abstract URI sourceImage(); public abstract URI sourceImage();
@Nullable public abstract String diskType(); @Nullable public abstract URI diskType();
static InitializeParams create(URI sourceImage) { static InitializeParams create(URI sourceImage) {
return create(null, null, sourceImage, null); return create(null, null, sourceImage, null);
} }
@SerializedNames({ "diskName", "diskSizeGb", "sourceImage", "diskType" }) @SerializedNames({ "diskName", "diskSizeGb", "sourceImage", "diskType" })
public static InitializeParams create(String diskName, Long diskSizeGb, URI sourceImage, String diskType) { public static InitializeParams create(String diskName, Long diskSizeGb, URI sourceImage, URI diskType) {
return new AutoValue_AttachDisk_InitializeParams(diskName, diskSizeGb, sourceImage, diskType); return new AutoValue_AttachDisk_InitializeParams(diskName, diskSizeGb, sourceImage, diskType);
} }

View File

@ -195,7 +195,7 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
"test", // diskName "test", // diskName
Long.parseLong("100", 10), // diskSizeGb Long.parseLong("100", 10), // diskSizeGb
URI.create(url("/projects/party/global/images/test")), // sourceImage URI.create(url("/projects/party/global/images/test")), // sourceImage
"pd-standard" // diskType URI.create(url("/projects/party/zones/us-central1-a/diskTypes/pd-standard")) // diskType
), // initializeParams ), // initializeParams
true, // autoDelete true, // autoDelete
ImmutableList.of(url("/projects/suse-cloud/global/licenses/sles-12")), // licenses ImmutableList.of(url("/projects/suse-cloud/global/licenses/sles-12")), // licenses

View File

@ -18,24 +18,22 @@ package org.jclouds.googlecomputeengine.parse;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import javax.ws.rs.Consumes;
import java.net.URI; import java.net.URI;
import javax.ws.rs.Consumes; import com.google.common.collect.ImmutableList;
import org.jclouds.googlecomputeengine.domain.AttachDisk; import org.jclouds.googlecomputeengine.domain.AttachDisk;
import org.jclouds.googlecomputeengine.domain.AttachDisk.DiskInterface; import org.jclouds.googlecomputeengine.domain.AttachDisk.DiskInterface;
import org.jclouds.googlecomputeengine.domain.Instance; import org.jclouds.googlecomputeengine.domain.Instance;
import org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk; import org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk;
import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface; import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface;
import org.jclouds.googlecomputeengine.domain.Instance.ServiceAccount;
import org.jclouds.googlecomputeengine.domain.Instance.Scheduling.OnHostMaintenance; import org.jclouds.googlecomputeengine.domain.Instance.Scheduling.OnHostMaintenance;
import org.jclouds.googlecomputeengine.domain.Instance.ServiceAccount;
import org.jclouds.googlecomputeengine.domain.Metadata; import org.jclouds.googlecomputeengine.domain.Metadata;
import org.jclouds.googlecomputeengine.domain.Tags; import org.jclouds.googlecomputeengine.domain.Tags;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
@Test(groups = "unit", testName = "ParseInstanceTest") @Test(groups = "unit", testName = "ParseInstanceTest")
public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance> { public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance> {
@ -81,7 +79,7 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
"test", // diskName "test", // diskName
Long.parseLong("100", 10), // diskSizeGb Long.parseLong("100", 10), // diskSizeGb
URI.create(baseUrl + "/party/global/images/test"), // sourceImage URI.create(baseUrl + "/party/global/images/test"), // sourceImage
"pd-standard" // diskType URI.create(baseUrl + "/party/zones/us-central1-a/diskTypes/pd-standard") // diskType
), // initializeParams ), // initializeParams
ImmutableList.of(baseUrl + "/suse-cloud/global/licenses/sles-12"), // licenses ImmutableList.of(baseUrl + "/suse-cloud/global/licenses/sles-12"), // licenses
DiskInterface.NVME // interface DiskInterface.NVME // interface

View File

@ -9,7 +9,7 @@
"diskName": "test", "diskName": "test",
"sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test", "sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test",
"diskSizeGb": 100, "diskSizeGb": 100,
"diskType": "pd-standard" "diskType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/diskTypes/pd-standard"
}, },
"licenses": [ "licenses": [
"https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12" "https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"

View File

@ -30,7 +30,7 @@
"diskName": "test", "diskName": "test",
"sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test", "sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test",
"diskSizeGb": "100", "diskSizeGb": "100",
"diskType": "pd-standard" "diskType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/diskTypes/pd-standard"
}, },
"licenses": [ "licenses": [
"https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12" "https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"

View File

@ -35,7 +35,7 @@
"diskName": "test", "diskName": "test",
"sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test", "sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test",
"diskSizeGb": "100", "diskSizeGb": "100",
"diskType": "pd-standard" "diskType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/diskTypes/pd-standard"
}, },
"licenses": [ "licenses": [
"https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12" "https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"