use of org.graylog2.shared.security.RestrictToLeader in project graylog2-server by Graylog2.
the class DeflectorResource method cycle.
@POST
@Timed
@ApiOperation(value = "Cycle deflector to new/next index in index set")
@RequiresPermissions(RestPermissions.DEFLECTOR_CYCLE)
@Path("/{indexSetId}/cycle")
@RestrictToLeader
@AuditEvent(type = AuditEventTypes.ES_WRITE_INDEX_UPDATE_JOB_START)
public void cycle(@ApiParam(name = "indexSetId") @PathParam("indexSetId") String indexSetId) {
final IndexSet indexSet = getIndexSet(indexSetRegistry, indexSetId);
checkCycle(indexSet);
final String msg = "Cycling deflector for index set <" + indexSetId + ">. Reason: REST request.";
LOG.info(msg);
activityWriter.write(new Activity(msg, DeflectorResource.class));
indexSet.cycle();
}
use of org.graylog2.shared.security.RestrictToLeader in project graylog2-server by Graylog2.
the class DeflectorResource method deprecatedCycle.
@POST
@Timed
@ApiOperation(value = "Cycle deflector to new/next index")
@RequiresPermissions(RestPermissions.DEFLECTOR_CYCLE)
@Path("/cycle")
@RestrictToLeader
@AuditEvent(type = AuditEventTypes.ES_WRITE_INDEX_UPDATE_JOB_START)
@Deprecated
public void deprecatedCycle() {
final IndexSet indexSet = indexSetRegistry.getDefault();
checkCycle(indexSet);
final String msg = "Cycling deflector for default index set <" + indexSet.getConfig().id() + ">. Reason: REST request.";
LOG.info(msg);
activityWriter.write(new Activity(msg, DeflectorResource.class));
indexSet.cycle();
}
Aggregations