Repository: jclouds-labs Updated Branches: refs/heads/master 2f4dc796c -> f588d6b6f
Profitbricks REST - Image API Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/f588d6b6 Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/f588d6b6 Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/f588d6b6 Branch: refs/heads/master Commit: f588d6b6f9fa3ddf61dfe8c7572ff4ee353c7f24 Parents: 2f4dc79 Author: mirza-spc <[email protected]> Authored: Mon Feb 29 12:03:06 2016 +0100 Committer: Ignasi Barrera <[email protected]> Committed: Wed Mar 2 23:03:38 2016 +0100 ---------------------------------------------------------------------- .../profitbricks/rest/ProfitBricksApi.java | 4 + .../binder/image/UpdateImageRequestBinder.java | 98 +++++ .../jclouds/profitbricks/rest/domain/Image.java | 81 +++- .../profitbricks/rest/features/ImageApi.java | 37 ++ .../image/UpdateImageRequestBinderTest.java | 65 +++ .../rest/features/DataCenterApiMockTest.java | 22 + .../rest/features/ImageApiLiveTest.java | 55 +++ .../rest/features/ImageApiMockTest.java | 122 ++++++ .../rest/features/ServerApiMockTest.java | 23 +- .../rest/features/VolumeApiMockTest.java | 22 + .../internal/BaseProfitBricksApiMockTest.java | 4 + .../src/test/resources/image/get-depth-5.json | 32 ++ .../src/test/resources/image/get.json | 32 ++ .../src/test/resources/image/list-depth-5.json | 167 ++++++++ .../src/test/resources/image/list.json | 423 +++++++++++++++++++ 15 files changed, 1185 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/ProfitBricksApi.java ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/ProfitBricksApi.java b/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/ProfitBricksApi.java index 44d4c0d..90e5fc8 100644 --- a/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/ProfitBricksApi.java +++ b/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/ProfitBricksApi.java @@ -20,6 +20,7 @@ package org.apache.jclouds.profitbricks.rest; import com.google.common.annotations.Beta; import java.io.Closeable; import org.apache.jclouds.profitbricks.rest.features.DataCenterApi; +import org.apache.jclouds.profitbricks.rest.features.ImageApi; import org.apache.jclouds.profitbricks.rest.features.ServerApi; import org.apache.jclouds.profitbricks.rest.features.SnapshotApi; import org.apache.jclouds.profitbricks.rest.features.VolumeApi; @@ -36,6 +37,9 @@ public interface ProfitBricksApi extends Closeable { @Delegate VolumeApi volumeApi(); + + @Delegate + ImageApi imageApi(); @Delegate SnapshotApi snapshotApi(); http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/binder/image/UpdateImageRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/binder/image/UpdateImageRequestBinder.java b/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/binder/image/UpdateImageRequestBinder.java new file mode 100644 index 0000000..6dd2c30 --- /dev/null +++ b/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/binder/image/UpdateImageRequestBinder.java @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jclouds.profitbricks.rest.binder.image; + +import static com.google.common.base.Preconditions.checkNotNull; +import com.google.inject.Inject; +import java.util.HashMap; +import java.util.Map; +import org.apache.jclouds.profitbricks.rest.binder.BaseProfitBricksRequestBinder; +import org.apache.jclouds.profitbricks.rest.domain.Image; +import org.jclouds.http.HttpRequest; +import org.jclouds.json.Json; + +public class UpdateImageRequestBinder extends BaseProfitBricksRequestBinder<Image.Request.UpdatePayload> { + + final Map<String, Object> requestBuilder; + final Json jsonBinder; + + private String imageId; + + @Inject + UpdateImageRequestBinder(Json jsonBinder) { + super("image"); + this.jsonBinder = jsonBinder; + this.requestBuilder = new HashMap<String, Object>(); + } + + @Override + protected String createPayload(Image.Request.UpdatePayload payload) { + + checkNotNull(payload, "payload"); + checkNotNull(payload.id(), "imageId"); + + imageId = payload.id(); + + if (payload.name() != null) + requestBuilder.put("name", payload.name()); + + if (payload.description() != null) + requestBuilder.put("description", payload.description()); + + if (payload.licenceType() != null) + requestBuilder.put("licenceType", payload.licenceType()); + + if (payload.cpuHotPlug() != null) + requestBuilder.put("cpuHotPlug", payload.cpuHotPlug()); + + if (payload.cpuHotUnplug() != null) + requestBuilder.put("cpuHotUnplug", payload.cpuHotUnplug()); + + if (payload.ramHotPlug() != null) + requestBuilder.put("ramHotPlug", payload.ramHotPlug()); + + if (payload.ramHotUnplug() != null) + requestBuilder.put("ramHotUnplug", payload.ramHotUnplug()); + + if (payload.nicHotPlug() != null) + requestBuilder.put("nicHotPlug", payload.nicHotPlug()); + + if (payload.nicHotUnplug() != null) + requestBuilder.put("nicHotUnplug", payload.nicHotUnplug()); + + if (payload.discVirtioHotPlug() != null) + requestBuilder.put("discVirtioHotPlug", payload.discVirtioHotPlug()); + + if (payload.discVirtioHotUnplug() != null) + requestBuilder.put("discVirtioHotUnplug", payload.discVirtioHotUnplug()); + + if (payload.discScsiHotPlug() != null) + requestBuilder.put("discScsiHotPlug", payload.discScsiHotPlug()); + + if (payload.discScsiHotUnplug() != null) + requestBuilder.put("discScsiHotUnplug", payload.discScsiHotUnplug()); + + return jsonBinder.toJson(requestBuilder); + } + + @Override + protected <R extends HttpRequest> R createRequest(R fromRequest, String payload) { + R request = (R) fromRequest.toBuilder().replacePath(String.format("/rest/images/%s", imageId)).build(); + return super.createRequest(request, payload); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/Image.java ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/Image.java b/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/Image.java index 751ebc8..7adf364 100644 --- a/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/Image.java +++ b/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/Image.java @@ -96,7 +96,86 @@ public abstract class Image { return new AutoValue_Image_Properties(name, description, location, size, isPublic, licenceType, imageType, cpuHotPlug, cpuHotUnplug, ramHotPlug, ramHotUnplug, nicHotPlug, nicHotUnplug, discVirtioHotPlug, discVirtioHotUnplug, discScsiHotPlug, discScsiHotUnplug); } - } + } + + public static final class Request { + + public static UpdatePayload.Builder updatingBuilder() { + return new AutoValue_Image_Request_UpdatePayload.Builder(); + } + + @AutoValue + public abstract static class UpdatePayload { + + public abstract String id(); + + @Nullable + public abstract String name(); + + @Nullable + public abstract String description(); + + @Nullable + public abstract LicenceType licenceType(); + + @Nullable + public abstract Boolean cpuHotPlug(); + + @Nullable + public abstract Boolean cpuHotUnplug(); + + @Nullable + public abstract Boolean ramHotPlug(); + + @Nullable + public abstract Boolean ramHotUnplug(); + + @Nullable + public abstract Boolean nicHotPlug(); + + @Nullable + public abstract Boolean nicHotUnplug(); + + @Nullable + public abstract Boolean discVirtioHotPlug(); + + @Nullable + public abstract Boolean discVirtioHotUnplug(); + + @Nullable + public abstract Boolean discScsiHotPlug(); + + @Nullable + public abstract Boolean discScsiHotUnplug(); + + @AutoValue.Builder + public abstract static class Builder { + + public abstract Builder id(String id); + public abstract Builder name(String name); + public abstract Builder description(String description); + public abstract Builder licenceType(LicenceType licenceType); + public abstract Builder cpuHotPlug(Boolean cpuHotPlug); + public abstract Builder cpuHotUnplug(Boolean cpuHotUnplug); + public abstract Builder ramHotPlug(Boolean ramHotPlug); + public abstract Builder ramHotUnplug(Boolean ramHotUnplug); + public abstract Builder nicHotPlug(Boolean nicHotPlug); + public abstract Builder nicHotUnplug(Boolean nicHotUnplug); + public abstract Builder discVirtioHotPlug(Boolean discVirtioHotPlug); + public abstract Builder discVirtioHotUnplug(Boolean discVirtioHotUnplug); + public abstract Builder discScsiHotPlug(Boolean discScsiHotPlug); + public abstract Builder discScsiHotUnplug(Boolean discScsiHotUnplug); + + abstract UpdatePayload autoBuild(); + + public UpdatePayload build() { + return autoBuild(); + } + } + } + + } + public enum Type { http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/features/ImageApi.java ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/features/ImageApi.java b/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/features/ImageApi.java index 51b3996..74a7e72 100644 --- a/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/features/ImageApi.java +++ b/profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/features/ImageApi.java @@ -19,17 +19,54 @@ package org.apache.jclouds.profitbricks.rest.features; import com.google.inject.Inject; import com.google.inject.TypeLiteral; import java.io.Closeable; +import java.util.List; +import javax.inject.Named; +import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.PathParam; import org.apache.jclouds.profitbricks.rest.domain.Image; +import org.apache.jclouds.profitbricks.rest.domain.options.DepthOptions; +import org.jclouds.Fallbacks; +import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404; import org.jclouds.http.filters.BasicAuthentication; import org.jclouds.http.functions.ParseJson; import org.jclouds.json.Json; +import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.ResponseParser; +import org.jclouds.rest.annotations.SelectJson; @Path("/images") @RequestFilters(BasicAuthentication.class) public interface ImageApi extends Closeable { + + @Named("image:list") + @GET + @SelectJson("items") + @Fallback(EmptyListOnNotFoundOr404.class) + List<Image> getList(); + + @Named("image:list") + @GET + @SelectJson("items") + @Fallback(EmptyListOnNotFoundOr404.class) + List<Image> getList(DepthOptions options); + + @Named("image:get") + @GET + @Path("/{imageId}") + @ResponseParser(ImageApi.ImageParser.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + Image getImage(@PathParam("imageId") String imageId); + + @Named("image:get") + @GET + @Path("/{imageId}") + @ResponseParser(ImageApi.ImageParser.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + Image getImage(@PathParam("imageId") String imageId, DepthOptions options); + static final class ImageParser extends ParseJson<Image> { @Inject ImageParser(Json json) { super(json, TypeLiteral.get(Image.class)); http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/binder/image/UpdateImageRequestBinderTest.java ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/binder/image/UpdateImageRequestBinderTest.java b/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/binder/image/UpdateImageRequestBinderTest.java new file mode 100644 index 0000000..51f15e1 --- /dev/null +++ b/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/binder/image/UpdateImageRequestBinderTest.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jclouds.profitbricks.rest.binder.image; + +import com.google.inject.Guice; +import com.google.inject.Injector; +import java.util.HashMap; +import org.apache.jclouds.profitbricks.rest.domain.Image; +import org.jclouds.http.HttpRequest; +import org.jclouds.json.Json; +import org.jclouds.json.config.GsonModule; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import org.testng.annotations.Test; + +@Test(groups = "unit", testName = "UpdateImageRequestBinderTest") +public class UpdateImageRequestBinderTest { + + @Test + public void testUpdatePayload() { + + Injector injector = Guice.createInjector(new GsonModule()); + UpdateImageRequestBinder binder = injector.getInstance(UpdateImageRequestBinder.class); + + Image.Request.UpdatePayload payload = Image.Request.updatingBuilder() + .id("some-id") + .name("new-image-name") + .description("description...") + .build(); + + String actual = binder.createPayload(payload); + + HttpRequest request = binder.createRequest( + HttpRequest.builder().method("POST").endpoint("http://test.com").build(), + actual + ); + + assertEquals(request.getEndpoint().getPath(), "/rest/images/some-id"); + assertNotNull(actual, "Binder returned null payload"); + + Json json = injector.getInstance(Json.class); + + HashMap<String, Object> expectedPayload = new HashMap<String, Object>(); + + expectedPayload.put("name", "new-image-name"); + expectedPayload.put("description", "description..."); + + assertEquals(actual, json.toJson(expectedPayload)); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/DataCenterApiMockTest.java ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/DataCenterApiMockTest.java b/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/DataCenterApiMockTest.java index f4d2e11..4e73323 100644 --- a/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/DataCenterApiMockTest.java +++ b/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/DataCenterApiMockTest.java @@ -24,6 +24,8 @@ import org.apache.jclouds.profitbricks.rest.domain.options.DepthOptions; import org.apache.jclouds.profitbricks.rest.internal.BaseProfitBricksApiMockTest; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertTrue; import org.testng.annotations.Test; @Test(groups = "unit", testName = "DataCenterApiMockTest", singleThreaded = true) @@ -44,6 +46,15 @@ public class DataCenterApiMockTest extends BaseProfitBricksApiMockTest { assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "/datacenters"); } + + @Test + public void testGetListWith404() throws InterruptedException { + server.enqueue(response404()); + List<DataCenter> list = dataCenterApi().list(new DepthOptions().depth(1)); + assertTrue(list.isEmpty()); + assertEquals(server.getRequestCount(), 1); + assertSent(server, "GET", "/datacenters?depth=1"); + } @Test public void testGetDataCenter() throws InterruptedException { @@ -62,6 +73,17 @@ public class DataCenterApiMockTest extends BaseProfitBricksApiMockTest { assertSent(server, "GET", "/datacenters/some-id"); } + public void testGetDataCenterWith404() throws InterruptedException { + server.enqueue(response404()); + + DataCenter dataCenter = dataCenterApi().getDataCenter("some-id"); + + assertNull(dataCenter); + + assertEquals(server.getRequestCount(), 1); + assertSent(server, "GET", "/datacenters/some-id"); + } + @Test public void testCreate() throws InterruptedException { server.enqueue( http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/ImageApiLiveTest.java ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/ImageApiLiveTest.java b/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/ImageApiLiveTest.java new file mode 100644 index 0000000..a7caaff --- /dev/null +++ b/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/ImageApiLiveTest.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jclouds.profitbricks.rest.features; + +import java.util.List; +import org.apache.jclouds.profitbricks.rest.domain.Image; +import org.apache.jclouds.profitbricks.rest.internal.BaseProfitBricksLiveTest; +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; + +@Test(groups = "live", testName = "ImageApiLiveTest") +public class ImageApiLiveTest extends BaseProfitBricksLiveTest { + + String testImageId = "7cb4b3a3-50c3-11e5-b789-52540066fee9"; + + @Test + public void testGetImage() { + Image image = imageApi().getImage(testImageId); + + assertNotNull(image); + assertEquals(image.id(), testImageId); + assertEquals(image.properties().name(), "ubuntu-14.04.3-server-amd64.iso"); + } + + @Test + public void testList() { + List<Image> images = imageApi().getList(); + + assertNotNull(images); + assertFalse(images.isEmpty()); + assertTrue(images.size() > 1); + } + + private ImageApi imageApi() { + return api.imageApi(); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/ImageApiMockTest.java ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/ImageApiMockTest.java b/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/ImageApiMockTest.java new file mode 100644 index 0000000..a668dc7 --- /dev/null +++ b/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/ImageApiMockTest.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jclouds.profitbricks.rest.features; + +import com.squareup.okhttp.mockwebserver.MockResponse; +import java.util.List; +import org.apache.jclouds.profitbricks.rest.domain.Image; +import org.apache.jclouds.profitbricks.rest.domain.options.DepthOptions; +import org.apache.jclouds.profitbricks.rest.internal.BaseProfitBricksApiMockTest; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; +import org.testng.annotations.Test; + +@Test(groups = "unit", testName = "ImageApiMockTest", singleThreaded = true) +public class ImageApiMockTest extends BaseProfitBricksApiMockTest { + + @Test + public void testGetList() throws InterruptedException { + server.enqueue( + new MockResponse().setBody(stringFromResource("/image/list.json")) + ); + + List<Image> list = imageApi().getList(); + + assertNotNull(list); + assertEquals(list.size(), 13); + assertEquals(list.get(0).properties().name(), "bacula-client-agent.iso"); + + assertEquals(server.getRequestCount(), 1); + assertSent(server, "GET", "/images"); + } + + @Test + public void testGetListWithDepth() throws InterruptedException { + server.enqueue( + new MockResponse().setBody(stringFromResource("/image/list-depth-5.json")) + ); + + List<Image> list = imageApi().getList(new DepthOptions().depth(5)); + + assertNotNull(list); + assertEquals(list.size(), 5); + assertEquals(list.get(0).properties().name(), "bacula-client-agent.iso"); + + assertEquals(server.getRequestCount(), 1); + assertSent(server, "GET", "/images?depth=5"); + } + + @Test + public void testGetListWith404() throws InterruptedException { + server.enqueue(new MockResponse().setResponseCode(404)); + List<Image> list = imageApi().getList(new DepthOptions().depth(1)); + assertTrue(list.isEmpty()); + assertEquals(server.getRequestCount(), 1); + assertSent(server, "GET", "/images?depth=1"); + } + + @Test + public void testGetImage() throws InterruptedException { + MockResponse response = new MockResponse(); + response.setBody(stringFromResource("/image/get.json")); + response.setHeader("Content-Type", "application/vnd.profitbricks.resource+json"); + + server.enqueue(response); + + Image image = imageApi().getImage("some-id"); + + assertNotNull(image); + assertEquals(image.properties().name(), "CentOS-6.7-x86_64-netinstall.iso"); + + assertEquals(server.getRequestCount(), 1); + assertSent(server, "GET", "/images/some-id"); + } + + @Test + public void testGetImageWithDepth() throws InterruptedException { + MockResponse response = new MockResponse(); + response.setBody(stringFromResource("/image/get-depth-5.json")); + response.setHeader("Content-Type", "application/vnd.profitbricks.resource+json"); + + server.enqueue(response); + + Image image = imageApi().getImage("some-id", new DepthOptions().depth(5)); + + assertNotNull(image); + assertEquals(image.properties().name(), "bacula-client-agent.iso"); + + assertEquals(this.server.getRequestCount(), 1); + assertSent(this.server, "GET", "/images/some-id?depth=5"); + } + + public void testGetImageWith404() throws InterruptedException { + server.enqueue(response404()); + + Image volume = imageApi().getImage("some-id"); + + assertEquals(volume, null); + + assertEquals(this.server.getRequestCount(), 1); + assertSent(this.server, "GET", "/images/some-id"); + } + + private ImageApi imageApi() { + return api.imageApi(); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/ServerApiMockTest.java ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/ServerApiMockTest.java b/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/ServerApiMockTest.java index 20bbf0a..d08441e 100644 --- a/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/ServerApiMockTest.java +++ b/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/ServerApiMockTest.java @@ -25,6 +25,7 @@ import org.apache.jclouds.profitbricks.rest.domain.options.DepthOptions; import org.apache.jclouds.profitbricks.rest.internal.BaseProfitBricksApiMockTest; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; import org.testng.annotations.Test; @Test(groups = "unit", testName = "ServerApiMockTest", singleThreaded = true) @@ -61,7 +62,16 @@ public class ServerApiMockTest extends BaseProfitBricksApiMockTest { assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "/datacenters/datacenter-id/servers?depth=5"); } - + + @Test + public void testGetListWith404() throws InterruptedException { + server.enqueue(new MockResponse().setResponseCode(404)); + List<Server> list = serverApi().getList("datacenter-id", new DepthOptions().depth(1)); + assertTrue(list.isEmpty()); + assertEquals(server.getRequestCount(), 1); + assertSent(server, "GET", "/datacenters/datacenter-id/servers?depth=1"); + } + @Test public void testGetServer() throws InterruptedException { MockResponse response = new MockResponse(); @@ -96,6 +106,17 @@ public class ServerApiMockTest extends BaseProfitBricksApiMockTest { assertSent(this.server, "GET", "/datacenters/datacenter-id/servers/some-id?depth=5"); } + public void testGetServerWith404() throws InterruptedException { + server.enqueue(response404()); + + Server server = serverApi().getServer("datacenter-id", "some-id"); + + assertEquals(server, null); + + assertEquals(this.server.getRequestCount(), 1); + assertSent(this.server, "GET", "/datacenters/datacenter-id/servers/some-id"); + } + @Test public void testCreate() throws InterruptedException { server.enqueue( http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/VolumeApiMockTest.java ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/VolumeApiMockTest.java b/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/VolumeApiMockTest.java index 433063d..e91f6ef 100644 --- a/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/VolumeApiMockTest.java +++ b/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/VolumeApiMockTest.java @@ -20,9 +20,11 @@ import com.squareup.okhttp.mockwebserver.MockResponse; import java.util.List; import org.apache.jclouds.profitbricks.rest.domain.LicenceType; import org.apache.jclouds.profitbricks.rest.domain.Volume; +import org.apache.jclouds.profitbricks.rest.domain.options.DepthOptions; import org.apache.jclouds.profitbricks.rest.internal.BaseProfitBricksApiMockTest; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; import org.testng.annotations.Test; @Test(groups = "unit", testName = "VolumeApiMockTest", singleThreaded = true) @@ -43,6 +45,15 @@ public class VolumeApiMockTest extends BaseProfitBricksApiMockTest { assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "/datacenters/datacenter-id/volumes"); } + + @Test + public void testGetListWith404() throws InterruptedException { + server.enqueue(new MockResponse().setResponseCode(404)); + List<Volume> list = volumeApi().getList("datacenter-id", new DepthOptions().depth(1)); + assertTrue(list.isEmpty()); + assertEquals(server.getRequestCount(), 1); + assertSent(server, "GET", "/datacenters/datacenter-id/volumes?depth=1"); + } @Test public void testGetVolume() throws InterruptedException { @@ -60,6 +71,17 @@ public class VolumeApiMockTest extends BaseProfitBricksApiMockTest { assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "/datacenters/datacenter-id/volumes/some-id"); } + + public void testGetVolumeWith404() throws InterruptedException { + server.enqueue(response404()); + + Volume volume = volumeApi().getVolume("datacenter-id", "some-id"); + + assertEquals(volume, null); + + assertEquals(this.server.getRequestCount(), 1); + assertSent(this.server, "GET", "/datacenters/datacenter-id/volumes/some-id"); + } @Test public void testCreate() throws InterruptedException { http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/internal/BaseProfitBricksApiMockTest.java ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/internal/BaseProfitBricksApiMockTest.java b/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/internal/BaseProfitBricksApiMockTest.java index 5a21eb3..cbe8a62 100644 --- a/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/internal/BaseProfitBricksApiMockTest.java +++ b/profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/internal/BaseProfitBricksApiMockTest.java @@ -86,6 +86,10 @@ public class BaseProfitBricksApiMockTest { return new MockResponse().setStatus("HTTP/1.1 204 No Content"); } + protected MockResponse response404() { + return new MockResponse().setStatus("HTTP/1.1 404 Not Found"); + } + protected String stringFromResource(String resourceName) { try { return Resources.toString(getClass().getResource(resourceName), Charsets.UTF_8) http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/test/resources/image/get-depth-5.json ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/test/resources/image/get-depth-5.json b/profitbricks-rest/src/test/resources/image/get-depth-5.json new file mode 100644 index 0000000..58816db --- /dev/null +++ b/profitbricks-rest/src/test/resources/image/get-depth-5.json @@ -0,0 +1,32 @@ +{ + "id": "26cd88f2-6765-11e5-bd6e-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/26cd88f2-6765-11e5-bd6e-52540066fee9", + "metadata": { + "createdDate": "2015-09-30T11:19:44Z", + "createdBy": "System", + "etag": "7c276460c51c8dcbc2ae10642deedd29", + "lastModifiedDate": "2015-11-11T13:38:47Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "bacula-client-agent.iso", + "description": null, + "location": "us/lasdev", + "size": 0.12, + "cpuHotPlug": false, + "cpuHotUnplug": false, + "ramHotPlug": false, + "ramHotUnplug": false, + "nicHotPlug": false, + "nicHotUnplug": false, + "discVirtioHotPlug": false, + "discVirtioHotUnplug": false, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "OTHER", + "imageType": "CDROM", + "public": true + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/test/resources/image/get.json ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/test/resources/image/get.json b/profitbricks-rest/src/test/resources/image/get.json new file mode 100644 index 0000000..ef725a6 --- /dev/null +++ b/profitbricks-rest/src/test/resources/image/get.json @@ -0,0 +1,32 @@ +{ + "id": "5468d4f1-50bf-11e5-b789-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/5468d4f1-50bf-11e5-b789-52540066fee9", + "metadata": { + "createdDate": "2015-09-01T15:37:18Z", + "createdBy": "System", + "etag": "deeb6ea22d099ce8cddd1fc84e414fbe", + "lastModifiedDate": "2015-09-01T15:37:18Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "CentOS-6.7-x86_64-netinstall.iso", + "description": null, + "location": "us/las", + "size": 0.23, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": true, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "LINUX", + "imageType": "CDROM", + "public": true + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/test/resources/image/list-depth-5.json ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/test/resources/image/list-depth-5.json b/profitbricks-rest/src/test/resources/image/list-depth-5.json new file mode 100644 index 0000000..7b1701c --- /dev/null +++ b/profitbricks-rest/src/test/resources/image/list-depth-5.json @@ -0,0 +1,167 @@ +{ + "id": "images", + "type": "collection", + "href": "https://api.profitbricks.com/rest/images", + "items": [ + { + "id": "26cd88f2-6765-11e5-bd6e-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/26cd88f2-6765-11e5-bd6e-52540066fee9", + "metadata": { + "createdDate": "2015-09-30T11:19:44Z", + "createdBy": "System", + "etag": "7c276460c51c8dcbc2ae10642deedd29", + "lastModifiedDate": "2015-11-11T13:38:47Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "bacula-client-agent.iso", + "description": "", + "location": "us/lasdev", + "size": 0.12, + "cpuHotPlug": false, + "cpuHotUnplug": false, + "ramHotPlug": false, + "ramHotUnplug": false, + "nicHotPlug": false, + "nicHotUnplug": false, + "discVirtioHotPlug": false, + "discVirtioHotUnplug": false, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "OTHER", + "imageType": "CDROM", + "public": true + } + }, + { + "id": "05cadf29-6c12-11e4-beeb-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/05cadf29-6c12-11e4-beeb-52540066fee9", + "metadata": { + "createdDate": "2014-11-14T15:22:19Z", + "createdBy": "System", + "etag": "957e0eac7456fa7554e73bf0d18860eb", + "lastModifiedDate": "2014-11-14T15:22:19Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "Microsoft-SQL-2012-Full-trial-english.iso", + "description": "", + "location": "us/las", + "size": 4, + "cpuHotPlug": false, + "cpuHotUnplug": false, + "ramHotPlug": false, + "ramHotUnplug": false, + "nicHotPlug": false, + "nicHotUnplug": false, + "discVirtioHotPlug": false, + "discVirtioHotUnplug": false, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "OTHER", + "imageType": "CDROM", + "public": true + } + }, + { + "id": "4c68429f-c8f2-11e5-aa10-52540005ab80", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/4c68429f-c8f2-11e5-aa10-52540005ab80", + "metadata": { + "createdDate": "2016-02-01T14:44:29Z", + "createdBy": "System", + "etag": "01bd7e2f17b8528231f441fe240562f9", + "lastModifiedDate": "2016-02-01T14:44:29Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "Ubuntu-14.04-LTS-server-2016-02-01", + "description": "", + "location": "us/lasdev", + "size": 2, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": true, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "LINUX", + "imageType": "HDD", + "public": true + } + }, + { + "id": "5468d4f1-50bf-11e5-b789-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/5468d4f1-50bf-11e5-b789-52540066fee9", + "metadata": { + "createdDate": "2015-09-01T15:37:18Z", + "createdBy": "System", + "etag": "deeb6ea22d099ce8cddd1fc84e414fbe", + "lastModifiedDate": "2015-09-01T15:37:18Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "CentOS-6.7-x86_64-netinstall.iso", + "description": "", + "location": "us/las", + "size": 0.23, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": true, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "LINUX", + "imageType": "CDROM", + "public": true + } + }, + { + "id": "dfa08a48-7937-11e4-8053-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/dfa08a48-7937-11e4-8053-52540066fee9", + "metadata": { + "createdDate": "2014-12-01T08:56:00Z", + "createdBy": "System", + "etag": "66da22f2893f1de8945c27e11bbc7ebf", + "lastModifiedDate": "2014-12-01T08:56:00Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "openSUSE-13.2-NET-x86_64.iso", + "description": "", + "location": "de/fra", + "size": 0.08, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": true, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "LINUX", + "imageType": "CDROM", + "public": true + } + } +] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/f588d6b6/profitbricks-rest/src/test/resources/image/list.json ---------------------------------------------------------------------- diff --git a/profitbricks-rest/src/test/resources/image/list.json b/profitbricks-rest/src/test/resources/image/list.json new file mode 100644 index 0000000..d599a66 --- /dev/null +++ b/profitbricks-rest/src/test/resources/image/list.json @@ -0,0 +1,423 @@ +{ + "id": "images", + "type": "collection", + "href": "https://api.profitbricks.com/rest/images", + "items": [ + { + "id": "26cd88f2-6765-11e5-bd6e-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/26cd88f2-6765-11e5-bd6e-52540066fee9", + "metadata": { + "createdDate": "2015-09-30T11:19:44Z", + "createdBy": "System", + "etag": "7c276460c51c8dcbc2ae10642deedd29", + "lastModifiedDate": "2015-11-11T13:38:47Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "bacula-client-agent.iso", + "description": "", + "location": "us/lasdev", + "size": 0.12, + "cpuHotPlug": false, + "cpuHotUnplug": false, + "ramHotPlug": false, + "ramHotUnplug": false, + "nicHotPlug": false, + "nicHotUnplug": false, + "discVirtioHotPlug": false, + "discVirtioHotUnplug": false, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "OTHER", + "imageType": "CDROM", + "public": true + } + }, + { + "id": "05cadf29-6c12-11e4-beeb-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/05cadf29-6c12-11e4-beeb-52540066fee9", + "metadata": { + "createdDate": "2014-11-14T15:22:19Z", + "createdBy": "System", + "etag": "957e0eac7456fa7554e73bf0d18860eb", + "lastModifiedDate": "2014-11-14T15:22:19Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "Microsoft-SQL-2012-Full-trial-english.iso", + "description": "", + "location": "us/las", + "size": 4, + "cpuHotPlug": false, + "cpuHotUnplug": false, + "ramHotPlug": false, + "ramHotUnplug": false, + "nicHotPlug": false, + "nicHotUnplug": false, + "discVirtioHotPlug": false, + "discVirtioHotUnplug": false, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "OTHER", + "imageType": "CDROM", + "public": true + } + }, + { + "id": "5468d4f1-50bf-11e5-b789-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/5468d4f1-50bf-11e5-b789-52540066fee9", + "metadata": { + "createdDate": "2015-09-01T15:37:18Z", + "createdBy": "System", + "etag": "deeb6ea22d099ce8cddd1fc84e414fbe", + "lastModifiedDate": "2015-09-01T15:37:18Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "CentOS-6.7-x86_64-netinstall.iso", + "description": "", + "location": "us/las", + "size": 0.23, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": true, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "LINUX", + "imageType": "CDROM", + "public": true + } + }, + { + "id": "dfa08a48-7937-11e4-8053-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/dfa08a48-7937-11e4-8053-52540066fee9", + "metadata": { + "createdDate": "2014-12-01T08:56:00Z", + "createdBy": "System", + "etag": "66da22f2893f1de8945c27e11bbc7ebf", + "lastModifiedDate": "2014-12-01T08:56:00Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "openSUSE-13.2-NET-x86_64.iso", + "description": "", + "location": "de/fra", + "size": 0.08, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": true, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "LINUX", + "imageType": "CDROM", + "public": true + } + }, + { + "id": "282dfceb-5cb0-11e5-a0d1-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/282dfceb-5cb0-11e5-a0d1-52540066fee9", + "metadata": { + "createdDate": "2015-09-16T20:18:56Z", + "createdBy": "System", + "etag": "c23723441fa5892c5b5f82279143e8ac", + "lastModifiedDate": "2015-09-16T20:18:56Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "windows-2012-r2-server-setup.iso", + "description": "", + "location": "de/fra", + "size": 5, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": false, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "WINDOWS", + "imageType": "CDROM", + "public": true + } + }, + { + "id": "daf36f00-9815-11e5-b6a2-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/daf36f00-9815-11e5-b6a2-52540066fee9", + "metadata": { + "createdDate": "2015-12-01T10:25:33Z", + "createdBy": "System", + "etag": "76ede5da4cd7ae5ab8a1287d810c3e00", + "lastModifiedDate": "2015-12-01T10:25:33Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "ubuntu-15.10-server-amd64.iso", + "description": "", + "location": "us/lasdev", + "size": 0.62, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": true, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "LINUX", + "imageType": "CDROM", + "public": true + } + }, + { + "id": "28c6d11d-683d-11e5-bd6e-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/28c6d11d-683d-11e5-bd6e-52540066fee9", + "metadata": { + "createdDate": "2015-10-01T13:05:59Z", + "createdBy": "System", + "etag": "a5e409a33ac85f5a6bb5aa53c184cced", + "lastModifiedDate": "2015-11-11T13:44:08Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "debian-8.2.0-amd64-netinst.iso", + "description": "", + "location": "us/lasdev", + "size": 0.25, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": true, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "LINUX", + "imageType": "CDROM", + "public": true + } + }, + { + "id": "4821987b-5d31-11e5-8706-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/4821987b-5d31-11e5-8706-52540066fee9", + "metadata": { + "createdDate": "2015-09-17T11:43:14Z", + "createdBy": "System", + "etag": "cf6568f3aca8a6887b8ebf7004c5e634", + "lastModifiedDate": "2015-11-11T14:01:53Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "windows-2012-r2-server-setup.iso", + "description": "", + "location": "us/lasdev", + "size": 5, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": false, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "WINDOWS", + "imageType": "CDROM", + "public": true + } + }, + { + "id": "78ad9179-97df-11e5-b6a2-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/78ad9179-97df-11e5-b6a2-52540066fee9", + "metadata": { + "createdDate": "2015-12-01T03:56:16Z", + "createdBy": "System", + "etag": "9906e3a475a0675dcb2fbac57780e5d5", + "lastModifiedDate": "2015-12-01T03:56:16Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "Ubuntu-15.10-server-2015-12-01", + "description": "", + "location": "us/lasdev", + "size": 2, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": true, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "LINUX", + "imageType": "HDD", + "public": true + } + }, + { + "id": "a165e3cf-975d-11e5-b6a2-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/a165e3cf-975d-11e5-b6a2-52540066fee9", + "metadata": { + "createdDate": "2015-11-30T12:26:50Z", + "createdBy": "System", + "etag": "7c307db015088102c5aef5ede471f74a", + "lastModifiedDate": "2015-11-30T12:26:50Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "gparted-live-0.24.0-2-amd64.iso", + "description": "", + "location": "de/fra", + "size": 0.25, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": true, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "LINUX", + "imageType": "CDROM", + "public": true + } + }, + { + "id": "0b2e8163-2143-11e4-9965-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/0b2e8163-2143-11e4-9965-52540066fee9", + "metadata": { + "createdDate": "2014-08-11T10:34:16Z", + "createdBy": "System", + "etag": "0ce81984ff360fc0fb6089dd3e7f2ab4", + "lastModifiedDate": "2015-06-24T11:36:26Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "ubuntu-12.04.5-server-amd64.iso", + "description": "", + "location": "us/las", + "size": 0.68, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": true, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "LINUX", + "imageType": "CDROM", + "public": true + } + }, + { + "id": "fa7c234c-682b-11e5-bd6e-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/fa7c234c-682b-11e5-bd6e-52540066fee9", + "metadata": { + "createdDate": "2015-10-01T11:02:59Z", + "createdBy": "System", + "etag": "63f6cadb05d94fde5301591c10cdc1da", + "lastModifiedDate": "2015-10-01T11:02:59Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "debian-8.2.0-amd64-netinst.iso", + "description": "", + "location": "de/fkb", + "size": 0.25, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": true, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "LINUX", + "imageType": "CDROM", + "public": true + } + }, + { + "id": "11388b1b-683d-11e5-bd6e-52540066fee9", + "type": "image", + "href": "https://api.profitbricks.com/rest/images/11388b1b-683d-11e5-bd6e-52540066fee9", + "metadata": { + "createdDate": "2015-10-01T13:05:19Z", + "createdBy": "System", + "etag": "145306cd1e32beb2446f432879e52229", + "lastModifiedDate": "2015-11-11T13:43:25Z", + "lastModifiedBy": "System", + "state": "AVAILABLE" + }, + "properties": { + "name": "debian-7.9.0-amd64-netinst.iso", + "description": "", + "location": "us/lasdev", + "size": 0.22, + "cpuHotPlug": true, + "cpuHotUnplug": false, + "ramHotPlug": true, + "ramHotUnplug": false, + "nicHotPlug": true, + "nicHotUnplug": true, + "discVirtioHotPlug": true, + "discVirtioHotUnplug": true, + "discScsiHotPlug": false, + "discScsiHotUnplug": false, + "licenceType": "LINUX", + "imageType": "CDROM", + "public": true + } + } + ] +} \ No newline at end of file
