本文整理汇总了Java中org.graylog2.audit.jersey.NoAuditEvent类的典型用法代码示例。如果您正苦于以下问题:Java NoAuditEvent类的具体用法?Java NoAuditEvent怎么用?Java NoAuditEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NoAuditEvent类属于org.graylog2.audit.jersey包,在下文中一共展示了NoAuditEvent类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.graylog2.audit.jersey.NoAuditEvent; //导入依赖的package包/类
@ApiOperation(value = "Parse a processing rule without saving it", notes = "")
@POST
@Path("/parse")
@NoAuditEvent("only used to parse a rule, no changes made in the system")
public RuleSource parse(@ApiParam(name = "rule", required = true) @NotNull RuleSource ruleSource) throws ParseException {
final Rule rule;
try {
// be silent about parse errors here, many requests will result in invalid syntax
rule = pipelineRuleParser.parseRule(ruleSource.id(), ruleSource.source(), true);
} catch (ParseException e) {
throw new BadRequestException(Response.status(Response.Status.BAD_REQUEST).entity(e.getErrors()).build());
}
return RuleSource.builder()
.title(rule.name())
.description(ruleSource.description())
.source(ruleSource.source())
.createdAt(DateTime.now())
.modifiedAt(DateTime.now())
.build();
}
示例2: parse
import org.graylog2.audit.jersey.NoAuditEvent; //导入依赖的package包/类
@ApiOperation(value = "Parse a processing pipeline without saving it", notes = "")
@POST
@Path("/parse")
@NoAuditEvent("only used to parse a pipeline, no changes made in the system")
public PipelineSource parse(@ApiParam(name = "pipeline", required = true) @NotNull PipelineSource pipelineSource) throws ParseException {
final Pipeline pipeline;
try {
pipeline = pipelineRuleParser.parsePipeline(pipelineSource.id(), pipelineSource.source());
} catch (ParseException e) {
throw new BadRequestException(Response.status(Response.Status.BAD_REQUEST).entity(e.getErrors()).build());
}
return PipelineSource.builder()
.title(pipeline.name())
.description(pipelineSource.description())
.source(pipelineSource.source())
.createdAt(DateTime.now())
.modifiedAt(DateTime.now())
.build();
}
示例3: getBulk
import org.graylog2.audit.jersey.NoAuditEvent; //导入依赖的package包/类
@ApiOperation("Retrieve the named processing rules in bulk")
@Path("/multiple")
@POST
@NoAuditEvent("only used to get multiple pipeline rules")
public Collection<RuleSource> getBulk(@ApiParam("rules") BulkRuleRequest rules) {
Collection<RuleDao> ruleDaos = ruleService.loadNamed(rules.rules());
return ruleDaos.stream()
.map(ruleDao -> RuleSource.fromDao(pipelineRuleParser, ruleDao))
.filter(rule -> isPermitted(PipelineRestPermissions.PIPELINE_RULE_READ, rule.id()))
.collect(Collectors.toList());
}
示例4: simulate
import org.graylog2.audit.jersey.NoAuditEvent; //导入依赖的package包/类
@ApiOperation(value = "Simulate the execution of the pipeline message processor")
@POST
@RequiresPermissions(PipelineRestPermissions.PIPELINE_RULE_READ)
@NoAuditEvent("only used to test pipelines, no changes made in the system")
public SimulationResponse simulate(@ApiParam(name = "simulation", required = true) @NotNull SimulationRequest request) throws NotFoundException {
checkPermission(RestPermissions.STREAMS_READ, request.streamId());
final Message message = new Message(request.message());
final Stream stream = streamService.load(request.streamId());
message.addStream(stream);
if (!Strings.isNullOrEmpty(request.inputId())) {
message.setSourceInputId(request.inputId());
}
final List<ResultMessageSummary> simulationResults = new ArrayList<>();
final PipelineInterpreterTracer pipelineInterpreterTracer = new PipelineInterpreterTracer();
org.graylog2.plugin.Messages processedMessages = pipelineInterpreter.process(message,
pipelineInterpreterTracer.getSimulatorInterpreterListener(),
pipelineStateUpdater.getLatestState());
for (Message processedMessage : processedMessages) {
simulationResults.add(ResultMessageSummary.create(null, processedMessage.getFields(), ""));
}
return SimulationResponse.create(simulationResults,
pipelineInterpreterTracer.getExecutionTrace(),
pipelineInterpreterTracer.took());
}
示例5: register
import org.graylog2.audit.jersey.NoAuditEvent; //导入依赖的package包/类
@PUT
@Timed
@Path("/{collectorId}")
@ApiOperation(value = "Create/update a collector registration",
notes = "This is a stateless method which upserts a collector registration")
@ApiResponses(value = {
@ApiResponse(code = 400, message = "The supplied request is not valid.")
})
@NoAuditEvent("this is only a ping from collectors, and would overflow the audit log")
public Response register(@ApiParam(name = "collectorId", value = "The collector id this collector is registering as.", required = true)
@PathParam("collectorId") @NotEmpty String collectorId,
@ApiParam(name = "JSON body", required = true)
@Valid @NotNull CollectorRegistrationRequest request,
@HeaderParam(value = "X-Graylog-Collector-Version") @NotEmpty String collectorVersion) {
final Collector collector = collectorService.fromRequest(collectorId, request, collectorVersion);
collectorService.save(collector);
final CollectorActions collectorActions = collectorService.findActionByCollector(collectorId, true);
List<CollectorAction> collectorAction = null;
if (collectorActions != null) {
collectorAction = collectorActions.getAction();
}
final CollectorSystemConfiguration collectorSystemConfiguration = configSupplier.get();
CollectorRegistrationResponse collectorRegistrationResponse = CollectorRegistrationResponse.create(
CollectorRegistrationConfiguration.create(
collectorSystemConfiguration.collectorUpdateInterval().toStandardDuration().getStandardSeconds(),
collectorSystemConfiguration.collectorSendStatus()),
collectorSystemConfiguration.collectorConfigurationOverride(),
collectorAction);
return Response.accepted(collectorRegistrationResponse).build();
}
示例6: mapData
import org.graylog2.audit.jersey.NoAuditEvent; //导入依赖的package包/类
@POST
@Timed
@ApiOperation(value = "Get map data")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@NoAuditEvent("only used to fetch map data, no changes made in the system")
public MapDataSearchResult mapData(@ApiParam(name = "JSON body", required = true) MapDataSearchRequest request) {
final String filter = "streams:" + request.streamId();
switch (request.timerange().type()) {
case AbsoluteRange.ABSOLUTE:
checkSearchPermission(filter, RestPermissions.SEARCHES_ABSOLUTE);
break;
case RelativeRange.RELATIVE:
checkSearchPermission(filter, RestPermissions.SEARCHES_RELATIVE);
break;
case KeywordRange.KEYWORD:
checkSearchPermission(filter, RestPermissions.SEARCHES_KEYWORD);
break;
}
try {
return search.searchMapData(request);
} catch (MapDataSearch.ValueTypeException e) {
LOG.error("Map data query failed: {}", e.getMessage());
throw new BadRequestException(e.getMessage());
}
}