Commit 0d387ae4 authored by Marco Descher's avatar Marco Descher 🏔

[15349] Add base update post rest operation

parent 5ad039ce
Pipeline #10437 passed with stages
in 2 minutes and 19 seconds
......@@ -4,11 +4,13 @@ import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.p2.operations.Update;
import org.osgi.service.component.annotations.Component;
......@@ -17,14 +19,14 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Api(tags = { "p2" })
@Path("/p2")
@Path("p2")
@Component(service = UpdateResource.class, immediate = true)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public class UpdateResource {
@GET
@Path("updates/check")
@ApiOperation(nickname = "checkUpdates", value = "check for available updates")
@Path("updates")
@ApiOperation(nickname = "checkUpdate", value = "check for available updates")
public Response checkUpdates() {
List<String> resultList = new ArrayList<>();
Update[] possibleUpdates = ProvisioningHelper.getPossibleUpdates();
......@@ -35,5 +37,16 @@ public class UpdateResource {
}
return Response.ok(resultList).build();
}
@POST
@Path("updates")
@ApiOperation(nickname = "executeUpdate", value = "check for available updates")
public Response executeUpdates() {
IStatus updateAllFeatures = ProvisioningHelper.updateAllFeatures();
if(updateAllFeatures.isOK()) {
return Response.ok().build();
}
return Response.ok().build();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment