Search in sources :

Example 1 with RemoteSystemPluginResource

use of org.graylog2.shared.rest.resources.system.RemoteSystemPluginResource in project graylog2-server by Graylog2.

the class ClusterSystemPluginResource method list.

@GET
@Timed
@ApiOperation(value = "List all installed plugins on the given node")
public PluginList list(@ApiParam(name = "nodeId", value = "The id of the node where processing will be paused.", required = true) @PathParam("nodeId") String nodeId) throws IOException, NodeNotFoundException {
    final Node targetNode = nodeService.byNodeId(nodeId);
    final RemoteSystemPluginResource remoteSystemPluginResource = remoteInterfaceProvider.get(targetNode, this.authenticationToken, RemoteSystemPluginResource.class);
    final Response<PluginList> response = remoteSystemPluginResource.list().execute();
    if (response.isSuccessful()) {
        return response.body();
    } else {
        LOG.warn("Unable to get plugin list on node {}: {}", nodeId, response.message());
        throw new WebApplicationException(response.message(), BAD_GATEWAY);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) Node(org.graylog2.cluster.Node) PluginList(org.graylog2.rest.models.system.plugins.responses.PluginList) RemoteSystemPluginResource(org.graylog2.shared.rest.resources.system.RemoteSystemPluginResource) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

Timed (com.codahale.metrics.annotation.Timed)1 ApiOperation (io.swagger.annotations.ApiOperation)1 GET (javax.ws.rs.GET)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 Node (org.graylog2.cluster.Node)1 PluginList (org.graylog2.rest.models.system.plugins.responses.PluginList)1 RemoteSystemPluginResource (org.graylog2.shared.rest.resources.system.RemoteSystemPluginResource)1