当前位置: 首页>>代码示例>>Java>>正文


Java AuditEvent类代码示例

本文整理汇总了Java中org.graylog2.audit.jersey.AuditEvent的典型用法代码示例。如果您正苦于以下问题:Java AuditEvent类的具体用法?Java AuditEvent怎么用?Java AuditEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AuditEvent类属于org.graylog2.audit.jersey包,在下文中一共展示了AuditEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFromParser

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@ApiOperation(value = "Create a processing rule from source", notes = "")
@POST
@RequiresPermissions(PipelineRestPermissions.PIPELINE_RULE_CREATE)
@AuditEvent(type = PipelineProcessorAuditEventTypes.RULE_CREATE)
public RuleSource createFromParser(@ApiParam(name = "rule", required = true) @NotNull RuleSource ruleSource) throws ParseException {
    final Rule rule;
    try {
        rule = pipelineRuleParser.parseRule(ruleSource.id(), ruleSource.source(), false);
    } catch (ParseException e) {
        throw new BadRequestException(Response.status(Response.Status.BAD_REQUEST).entity(e.getErrors()).build());
    }
    final RuleDao newRuleSource = RuleDao.builder()
            .title(rule.name()) // use the name from the parsed rule source.
            .description(ruleSource.description())
            .source(ruleSource.source())
            .createdAt(DateTime.now())
            .modifiedAt(DateTime.now())
            .build();
    final RuleDao save = ruleService.save(newRuleSource);
    // TODO determine which pipelines could change because of this new rule (there could be pipelines referring to a previously unresolved rule)
    clusterBus.post(RulesChangedEvent.updatedRuleId(save.id()));
    log.debug("Created new rule {}", save);
    return RuleSource.fromDao(pipelineRuleParser, save);
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:25,代码来源:RuleResource.java

示例2: connectPipelines

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@ApiOperation(value = "Connect processing pipelines to a stream", notes = "")
@POST
@Path("/to_stream")
@RequiresPermissions(PipelineRestPermissions.PIPELINE_CONNECTION_EDIT)
@AuditEvent(type = PipelineProcessorAuditEventTypes.PIPELINE_CONNECTION_UPDATE)
public PipelineConnections connectPipelines(@ApiParam(name = "Json body", required = true) @NotNull PipelineConnections connection) throws NotFoundException {
    final String streamId = connection.streamId();
    // verify the stream exists
    checkPermission(RestPermissions.STREAMS_READ, streamId);
    streamService.load(streamId);

    // verify the pipelines exist
    for (String s : connection.pipelineIds()) {
        checkPermission(PipelineRestPermissions.PIPELINE_READ, s);
        pipelineService.load(s);
    }
    return savePipelineConnections(connection);
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:19,代码来源:PipelineConnectionsResource.java

示例3: createFromParser

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@ApiOperation(value = "Create a processing pipeline from source", notes = "")
@POST
@RequiresPermissions(PipelineRestPermissions.PIPELINE_CREATE)
@AuditEvent(type = PipelineProcessorAuditEventTypes.PIPELINE_CREATE)
public PipelineSource createFromParser(@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());
    }
    final PipelineDao pipelineDao = PipelineDao.builder()
            .title(pipeline.name())
            .description(pipelineSource.description())
            .source(pipelineSource.source())
            .createdAt(DateTime.now())
            .modifiedAt(DateTime.now())
            .build();
    final PipelineDao save = pipelineService.save(pipelineDao);
    clusterBus.post(PipelinesChangedEvent.updatedPipelineId(save.id()));
    log.debug("Created new pipeline {}", save);
    return PipelineSource.fromDao(pipelineRuleParser, save);
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:24,代码来源:PipelineResource.java

示例4: updateOutput

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@PUT
@Path("/configurations/{id}/outputs/{output_id}")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_UPDATE)
@ApiOperation(value = "Update a configuration output",
        notes = "This is a stateless method which updates a collector output")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "The supplied request is not valid.")
})
@AuditEvent(type = CollectorAuditEventTypes.OUTPUT_UPDATE)
public Response updateOutput(@ApiParam(name = "id", required = true)
                             @PathParam("id") @NotEmpty String id,
                             @ApiParam(name = "output_id", required = true)
                             @PathParam("output_id") @NotEmpty String outputId,
                             @ApiParam(name = "JSON body", required = true)
                             @Valid @NotNull CollectorOutput request) {
    etagService.invalidateAll();
    final CollectorConfiguration collectorConfiguration = collectorConfigurationService.updateOutputFromRequest(id, outputId, request);
    collectorConfigurationService.save(collectorConfiguration);

    return Response.accepted().build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:23,代码来源:CollectorConfigurationResource.java

示例5: updateInput

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@PUT
@Path("/configurations/{id}/inputs/{input_id}")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_UPDATE)
@ApiOperation(value = "Update a configuration input",
        notes = "This is a stateless method which updates a collector input")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "The supplied request is not valid.")
})
@AuditEvent(type = CollectorAuditEventTypes.INPUT_UPDATE)
public Response updateInput(@ApiParam(name = "id", required = true)
                            @PathParam("id") @NotEmpty String id,
                            @ApiParam(name = "input_id", required = true)
                            @PathParam("input_id") @NotEmpty String inputId,
                            @ApiParam(name = "JSON body", required = true) @Valid @NotNull CollectorInput request) {
    etagService.invalidateAll();
    final CollectorConfiguration collectorConfiguration = collectorConfigurationService.updateInputFromRequest(id, inputId, request);
    collectorConfigurationService.save(collectorConfiguration);

    return Response.accepted().build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:22,代码来源:CollectorConfigurationResource.java

示例6: updateSnippet

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@PUT
@Path("/configurations/{id}/snippets/{snippet_id}")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_UPDATE)
@ApiOperation(value = "Update a configuration snippet",
        notes = "This is a stateless method which updates a collector snippet")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "The supplied request is not valid.")
})
@AuditEvent(type = CollectorAuditEventTypes.SNIPPET_UPDATE)
public Response updateSnippet(@ApiParam(name = "id", required = true)
                              @PathParam("id") @NotEmpty String id,
                              @ApiParam(name = "snippet_id", required = true)
                              @PathParam("snippet_id") @NotEmpty String snippetId,
                              @ApiParam(name = "JSON body", required = true)
                              @Valid @NotNull CollectorConfigurationSnippet request) {
    etagService.invalidateAll();
    final CollectorConfiguration collectorConfiguration = collectorConfigurationService.updateSnippetFromRequest(id, snippetId, request);
    collectorConfigurationService.save(collectorConfiguration);

    return Response.accepted().build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:23,代码来源:CollectorConfigurationResource.java

示例7: createConfiguration

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@POST
@Path("/configurations")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_CREATE)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Create new collector configuration")
@AuditEvent(type = CollectorAuditEventTypes.CONFIGURATION_CREATE)
public CollectorConfiguration createConfiguration(@ApiParam(name = "createDefaults")
                                                  @QueryParam("createDefaults") RestBoolean createDefaults,
                                                  @ApiParam(name = "JSON body", required = true)
                                                  @Valid @NotNull CollectorConfiguration request) {
    etagService.invalidateAll();
    CollectorConfiguration collectorConfiguration;
    if (createDefaults != null && createDefaults.getValue()) {
        collectorConfiguration = collectorConfigurationService.fromRequestWithDefaultSnippets(request);
    } else {
        collectorConfiguration = collectorConfigurationService.fromRequest(request);
    }
    collectorConfigurationService.save(collectorConfiguration);
    return collectorConfiguration;
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:22,代码来源:CollectorConfigurationResource.java

示例8: updateConfigurationName

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@PUT
@Path("/configurations/{id}/name")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_UPDATE)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Updates a collector configuration name")
@AuditEvent(type = CollectorAuditEventTypes.CONFIGURATION_UPDATE)
public CollectorConfiguration updateConfigurationName(@ApiParam(name = "id")
                                                      @PathParam("id") String id,
                                                      @ApiParam(name = "JSON body", required = true)
                                                      @Valid @NotNull CollectorConfiguration request) {
    etagService.invalidateAll();
    final CollectorConfiguration persistedConfiguration = collectorConfigurationService.findById(id);
    final CollectorConfiguration newConfiguration = collectorConfigurationService.fromRequest(request);

    final CollectorConfiguration updatedConfiguration = persistedConfiguration.toBuilder()
            .name(newConfiguration.name())
            .build();

    collectorConfigurationService.save(updatedConfiguration);
    return updatedConfiguration;
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:23,代码来源:CollectorConfigurationResource.java

示例9: createOutput

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@POST
@Path("/configurations/{id}/outputs")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_CREATE)
@ApiOperation(value = "Create a configuration output",
        notes = "This is a stateless method which inserts a collector output")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "The supplied request is not valid.")
})
@AuditEvent(type = CollectorAuditEventTypes.OUTPUT_CREATE)
public Response createOutput(@ApiParam(name = "id", required = true)
                             @PathParam("id") @NotEmpty String id,
                             @ApiParam(name = "JSON body", required = true)
                             @Valid @NotNull CollectorOutput request) {
    etagService.invalidateAll();
    final CollectorConfiguration collectorConfiguration = collectorConfigurationService.withOutputFromRequest(id, request);
    collectorConfigurationService.save(collectorConfiguration);

    return Response.accepted().build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:21,代码来源:CollectorConfigurationResource.java

示例10: createInput

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@POST
@Path("/configurations/{id}/inputs")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_CREATE)
@ApiOperation(value = "Create a configuration input",
        notes = "This is a stateless method which inserts a collector input")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "The supplied request is not valid.")
})
@AuditEvent(type = CollectorAuditEventTypes.INPUT_CREATE)
public Response createInput(@ApiParam(name = "id", required = true)
                            @PathParam("id") @NotEmpty String id,
                            @ApiParam(name = "JSON body", required = true)
                            @Valid @NotNull CollectorInput request) {
    etagService.invalidateAll();
    final CollectorConfiguration collectorConfiguration = collectorConfigurationService.withInputFromRequest(id, request);
    collectorConfigurationService.save(collectorConfiguration);

    return Response.accepted().build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:21,代码来源:CollectorConfigurationResource.java

示例11: createSnippet

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@POST
@Path("/configurations/{id}/snippets")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_CREATE)
@ApiOperation(value = "Create a configuration snippet",
        notes = "This is a stateless method which inserts a collector configuration snippet")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "The supplied request is not valid.")
})
@AuditEvent(type = CollectorAuditEventTypes.SNIPPET_CREATE)
public Response createSnippet(@ApiParam(name = "id", required = true)
                              @PathParam("id") @NotEmpty String id,
                              @ApiParam(name = "JSON body", required = true)
                              @Valid @NotNull CollectorConfigurationSnippet request) {
    etagService.invalidateAll();
    final CollectorConfiguration collectorConfiguration = collectorConfigurationService.withSnippetFromRequest(id, request);
    collectorConfigurationService.save(collectorConfiguration);

    return Response.accepted().build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:21,代码来源:CollectorConfigurationResource.java

示例12: deleteOutput

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@DELETE
@Path("/configurations/{id}/outputs/{outputId}")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_DELETE)
@ApiOperation(value = "Delete output from configuration")
@ApiResponses(value = {
        @ApiResponse(code = 404, message = "Configuration or Output not found."),
        @ApiResponse(code = 400, message = "Invalid ObjectId."),
        @ApiResponse(code = 412, message = "Still inputs assigned to output")
})
@AuditEvent(type = CollectorAuditEventTypes.OUTPUT_DELETE)
public Response deleteOutput(@ApiParam(name = "id", required = true)
                             @PathParam("id") String id,
                             @PathParam("outputId") String outputId) throws NotFoundException {
    etagService.invalidateAll();
    int deleted = collectorConfigurationService.deleteOutput(id, outputId);
    switch (deleted) {
        case 0:
            return Response.status(Response.Status.NOT_FOUND).build();
        case -1:
            return Response.status(Response.Status.PRECONDITION_FAILED).build();
    }
    return Response.ok().build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:25,代码来源:CollectorConfigurationResource.java

示例13: deleteInput

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@DELETE
@Path("/configurations/{id}/inputs/{inputId}")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_DELETE)
@ApiOperation(value = "Delete input form configuration")
@ApiResponses(value = {
        @ApiResponse(code = 404, message = "Configuration or Input not found."),
        @ApiResponse(code = 400, message = "Invalid ObjectId.")
})
@AuditEvent(type = CollectorAuditEventTypes.INPUT_DELETE)
public void deleteInput(@ApiParam(name = "id", required = true)
                        @PathParam("id") String id,
                        @PathParam("inputId") String inputId) throws NotFoundException {
    etagService.invalidateAll();
    collectorConfigurationService.deleteInput(id, inputId);
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:17,代码来源:CollectorConfigurationResource.java

示例14: deleteSnippet

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@DELETE
@Path("/configurations/{id}/snippets/{snippetId}")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_DELETE)
@ApiOperation(value = "Delete snippet from configuration")
@ApiResponses(value = {
        @ApiResponse(code = 404, message = "Configuration or Snippet not found."),
        @ApiResponse(code = 400, message = "Invalid ObjectId.")
})
@AuditEvent(type = CollectorAuditEventTypes.SNIPPET_DELETE)
public void deleteSnippet(@ApiParam(name = "id", required = true)
                          @PathParam("id") String id,
                          @PathParam("snippetId") String snippetId) throws NotFoundException {
    etagService.invalidateAll();
    collectorConfigurationService.deleteSnippet(id, snippetId);
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:17,代码来源:CollectorConfigurationResource.java

示例15: setAction

import org.graylog2.audit.jersey.AuditEvent; //导入依赖的package包/类
@PUT
@Timed
@Path("/{collectorId}/action")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_UPDATE)
@ApiOperation(value = "Set a collector action")
@ApiResponses(value = {@ApiResponse(code = 400, message = "The supplied action is not valid.")})
@AuditEvent(type = CollectorAuditEventTypes.ACTION_UPDATE)
public Response setAction(@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 List<CollectorAction> request) {
    final CollectorActions collectorActions = collectorService.actionFromRequest(collectorId, request);
    collectorService.saveAction(collectorActions);

    return Response.accepted().build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:18,代码来源:CollectorResource.java


注:本文中的org.graylog2.audit.jersey.AuditEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。