Search in sources :

Example 1 with MessageProcessorsConfig

use of org.graylog2.messageprocessors.MessageProcessorsConfig in project graylog2-server by Graylog2.

the class MessageProcessorsResource method config.

@GET
@Timed
@ApiOperation(value = "Get message processor configuration")
@Path("config")
public MessageProcessorsConfigWithDescriptors config() {
    checkPermission(RestPermissions.CLUSTER_CONFIG_ENTRY_READ);
    final MessageProcessorsConfig config = clusterConfigService.getOrDefault(MessageProcessorsConfig.class, MessageProcessorsConfig.defaultConfig());
    return MessageProcessorsConfigWithDescriptors.fromConfig(config.withProcessors(processorClassNames), processorDescriptors);
}
Also used : MessageProcessorsConfig(org.graylog2.messageprocessors.MessageProcessorsConfig) Path(javax.ws.rs.Path) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with MessageProcessorsConfig

use of org.graylog2.messageprocessors.MessageProcessorsConfig in project graylog2-server by Graylog2.

the class MessageProcessorsResource method updateConfig.

@PUT
@Timed
@ApiOperation(value = "Update message processor configuration")
@Path("config")
@AuditEvent(type = AuditEventTypes.MESSAGE_PROCESSOR_CONFIGURATION_UPDATE)
public MessageProcessorsConfigWithDescriptors updateConfig(@ApiParam(name = "config", required = true) final MessageProcessorsConfigWithDescriptors configWithDescriptors) {
    checkPermission(RestPermissions.CLUSTER_CONFIG_ENTRY_EDIT);
    final MessageProcessorsConfig config = configWithDescriptors.toConfig();
    clusterConfigService.write(config.withProcessors(processorClassNames));
    return configWithDescriptors;
}
Also used : MessageProcessorsConfig(org.graylog2.messageprocessors.MessageProcessorsConfig) Path(javax.ws.rs.Path) Timed(com.codahale.metrics.annotation.Timed) ApiOperation(io.swagger.annotations.ApiOperation) AuditEvent(org.graylog2.audit.jersey.AuditEvent) PUT(javax.ws.rs.PUT)

Aggregations

Timed (com.codahale.metrics.annotation.Timed)2 ApiOperation (io.swagger.annotations.ApiOperation)2 Path (javax.ws.rs.Path)2 MessageProcessorsConfig (org.graylog2.messageprocessors.MessageProcessorsConfig)2 GET (javax.ws.rs.GET)1 PUT (javax.ws.rs.PUT)1 AuditEvent (org.graylog2.audit.jersey.AuditEvent)1