mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 18:51:10 +01:00
add rest api updateAllPlugins
This commit is contained in:
@@ -56,6 +56,21 @@ public class InstalledPluginResource {
|
||||
return Response.ok(collectionMapper.mapInstalled(plugins, available)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates all installed plugins.
|
||||
*/
|
||||
@POST
|
||||
@Path("/update")
|
||||
@StatusCodes({
|
||||
@ResponseCode(code = 200, condition = "success"),
|
||||
@ResponseCode(code = 500, condition = "internal server error")
|
||||
})
|
||||
@TypeHint(CollectionDto.class)
|
||||
public Response updateAll(@QueryParam("restart") boolean restartAfterInstallation) {
|
||||
pluginManager.updateAll(restartAfterInstallation);
|
||||
return Response.ok().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the installed plugin with the given id.
|
||||
*
|
||||
|
||||
@@ -12,6 +12,7 @@ import sonia.scm.plugin.PluginPermissions;
|
||||
import java.util.List;
|
||||
|
||||
import static de.otto.edison.hal.Embedded.embeddedBuilder;
|
||||
import static de.otto.edison.hal.Link.*;
|
||||
import static de.otto.edison.hal.Links.linkingTo;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
@@ -44,6 +45,9 @@ public class PluginDtoCollectionMapper {
|
||||
|
||||
Links.Builder linksBuilder = linkingTo()
|
||||
.with(Links.linkingTo().self(baseUrl).build());
|
||||
|
||||
linksBuilder.single(link("update", resourceLinks.installedPluginCollection().update()));
|
||||
|
||||
return linksBuilder.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -686,6 +686,10 @@ class ResourceLinks {
|
||||
String self() {
|
||||
return installedPluginCollectionLinkBuilder.method("installedPlugins").parameters().method("getInstalledPlugins").parameters().href();
|
||||
}
|
||||
|
||||
String update() {
|
||||
return installedPluginCollectionLinkBuilder.method("installedPlugins").parameters().method("updateAll").parameters().href();
|
||||
}
|
||||
}
|
||||
|
||||
public AvailablePluginLinks availablePlugin() {
|
||||
|
||||
Reference in New Issue
Block a user