Ori Liel has uploaded a new change for review. Change subject: restapi: #854932 - remove update non-vm disk option ......................................................................
restapi: #854932 - remove update non-vm disk option Change-Id: I4839d4495925c71e26e0b4a2feae0d82709883b3 Signed-off-by: Ori Liel <[email protected]> --- M backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskResource.java M backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DisksResource.java M backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/VmDiskResource.java M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendDiskResource.java 4 files changed, 25 insertions(+), 19 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/8531/1 diff --git a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskResource.java b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskResource.java index 0190090..4c905ae 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskResource.java +++ b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskResource.java @@ -15,22 +15,14 @@ */ package org.ovirt.engine.api.resource; -import javax.ws.rs.Consumes; import javax.ws.rs.GET; -import javax.ws.rs.PUT; import javax.ws.rs.Produces; import org.jboss.resteasy.annotations.providers.jaxb.Formatted; import org.ovirt.engine.api.model.Disk; @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_X_YAML}) -public interface DiskResource extends DeviceResource<Disk>, MeasurableResource { - - @PUT - @Formatted - @Override - @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_X_YAML}) - public Disk update(Disk device); +public interface DiskResource extends ReadOnlyDeviceResource<Disk>, MeasurableResource { @GET @Formatted diff --git a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DisksResource.java b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DisksResource.java index 5df2cbc..1131369 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DisksResource.java +++ b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DisksResource.java @@ -1,17 +1,32 @@ package org.ovirt.engine.api.resource; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; +import javax.ws.rs.core.Response; +import org.jboss.resteasy.annotations.providers.jaxb.Formatted; import org.ovirt.engine.api.model.Disk; import org.ovirt.engine.api.model.Disks; @Path("/disks") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_X_YAML}) -public interface DisksResource extends DevicesResource<Disk, Disks>{ +public interface DisksResource extends ReadOnlyDevicesResource<Disk, Disks> { @Path("{identity}") @Override public DiskResource getDeviceSubResource(@PathParam("identity") String id); + + @POST + @Formatted + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_X_YAML }) + public Response add(Disk device); + + @DELETE + @Path("{id}") + public Response remove(@PathParam("id") String id); + } diff --git a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/VmDiskResource.java b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/VmDiskResource.java index 060047b..33fc194 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/VmDiskResource.java +++ b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/VmDiskResource.java @@ -18,6 +18,7 @@ import javax.ws.rs.Consumes; import javax.ws.rs.POST; +import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @@ -26,10 +27,11 @@ import org.jboss.resteasy.annotations.providers.jaxb.Formatted; import org.ovirt.engine.api.model.Action; import org.ovirt.engine.api.model.Actionable; +import org.ovirt.engine.api.model.Disk; @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_X_YAML}) -public interface VmDiskResource extends DiskResource { +public interface VmDiskResource extends DiskResource, DeviceResource<Disk> { @Path("{action: (activate|deactivate)}/{oid}") public ActionResource getActionSubresource(@PathParam("action") String action, @PathParam("oid") String oid); @@ -47,4 +49,9 @@ @Path("deactivate") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_X_YAML}) public Response deactivate(Action action); + + @PUT + @Formatted + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_X_YAML }) + public Disk update(Disk device); } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendDiskResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendDiskResource.java index 1b2ae72..1ebcd11 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendDiskResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendDiskResource.java @@ -6,7 +6,6 @@ import org.ovirt.engine.api.resource.StatisticsResource; import org.ovirt.engine.core.common.queries.GetDiskByDiskIdParameters; import org.ovirt.engine.core.common.queries.VdcQueryType; -import org.ovirt.engine.core.compat.NotImplementedException; public class BackendDiskResource extends AbstractBackendSubResource<Disk, org.ovirt.engine.core.common.businessentities.Disk> implements DiskResource { @@ -24,13 +23,6 @@ QueryIdResolver resolver = new QueryIdResolver(VdcQueryType.GetDiskByDiskId, GetDiskByDiskIdParameters.class); DiskStatisticalQuery query = new DiskStatisticalQuery(resolver, newModel(id)); return inject(new BackendStatisticsResource<Disk, org.ovirt.engine.core.common.businessentities.Disk>(entityType, guid, query)); - } - - @Override - public Disk update(Disk disk) { - //TODO: implmenet when Backend is ready. Implementation stub: -// return performUpdate(this, new QueryIdResolver(VdcQueryType.GetDiskByDiskId, GetDiskByDiskIdParameters.class), ?, ?); - throw new NotImplementedException("Pending Backend support"); } @Override -- To view, visit http://gerrit.ovirt.org/8531 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4839d4495925c71e26e0b4a2feae0d82709883b3 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Ori Liel <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
