@GET @Path("/{streamRuleId}") @Timed @ApiOperation(value = "Get a single stream rules") @Produces(MediaType.APPLICATION_JSON) public StreamRule get(@ApiParam(name = "streamid", value = "The id of the stream whose stream rule we want.", required = true) @PathParam("streamid") String streamid, @ApiParam(name = "streamRuleId", value = "The stream rule id we are getting", required = true) @PathParam("streamRuleId") String streamRuleId) throws NotFoundException { checkPermission(RestPermissions.STREAMS_READ, streamid); return streamRuleService.load(streamRuleId); }
@GET @Path("strategies") @Timed @ApiOperation(value = "List available rotation strategies", notes = "This resource returns a list of all available rotation strategies on this Graylog node.") public RotationStrategies list() { final Set<RotationStrategyDescription> strategies = rotationStrategies.keySet() .stream() .map(this::getRotationStrategyDescription) .collect(Collectors.toSet()); return RotationStrategies.create(strategies.size(), strategies); }
@GET @Path("/{name}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public Response getDeploymentGroup(@PathParam("name") final String name) { try { return Response.ok(model.getDeploymentGroup(name)).build(); } catch (final DeploymentGroupDoesNotExistException e) { return Response.status(Response.Status.NOT_FOUND).build(); } }
@GET @Path("/elasticsearch") @Timed @ApiOperation(value = "Elasticsearch information.", notes = "This resource returns information about the Elasticsearch Cluster.") public ElasticsearchStats elasticsearchStats() { return clusterStatsService.elasticsearchStats(); }
@POST @Path("/{streamRuleId}") @Timed @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @AuditEvent(type = AuditEventTypes.STREAM_RULE_UPDATE) @Deprecated public SingleStreamRuleSummaryResponse updateDeprecated(@PathParam("streamid") String streamid, @PathParam("streamRuleId") String streamRuleId, @Valid @NotNull CreateStreamRuleRequest cr) throws NotFoundException, ValidationException { checkNotDefaultStream(streamid, "Cannot remove stream rule from default stream."); return update(streamid, streamRuleId, cr); }
@GET @Path("/available") @Timed @ApiOperation(value = "Get a list of all alarm callback types") @Produces(MediaType.APPLICATION_JSON) @Deprecated public AvailableAlarmCallbacksResponse available(@ApiParam(name = "streamid", value = "The id of the stream whose alarm callbacks we want.", required = true) @PathParam("streamid") String streamid) { checkPermission(RestPermissions.STREAMS_READ, streamid); return alarmCallbacksResource.available(); }
@GET @ApiOperation(value = "Get supported locales") @Path("/locales") @Timed public LocalesResponse locales() { return LocalesResponse.create(Locale.getAvailableLocales()); }
@Timed @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{attachmentId}") public AttachmentUri redirectToAttachment(@Auth Account account, @PathParam("attachmentId") long attachmentId) throws IOException { return new AttachmentUri(urlSigner.getPreSignedUrl(attachmentId, HttpMethod.GET, Stream.of(UNACCELERATED_REGIONS).anyMatch(region -> account.getNumber().startsWith(region)))); }
@GET @Timed @Produces(MediaType.APPLICATION_JSON) public RegexReplaceTesterResponse regexTester(@QueryParam("regex") @NotEmpty String regex, @QueryParam("replacement") @NotNull String replacement, @QueryParam("replace_all") @DefaultValue("false") boolean replaceAll, @QueryParam("string") @NotNull String string) { return testRegexReplaceExtractor(string, regex, replacement, replaceAll); }
@Override protected NamingParameters getNamingParameters(MethodDescription instrumentedMethod) { if (instrumentedMethod.getDeclaredAnnotations().isAnnotationPresent(Timed.class)) { final Timed timed = instrumentedMethod.getDeclaredAnnotations().ofType(Timed.class).loadSilent(); return new NamingParameters(timed.name(), timed.absolute()); } else { return new NamingParameters("", false); } }
@GET @Path("strategies/{strategy}") @Timed @ApiOperation(value = "Show JSON schema for configuration of given retention strategies", notes = "This resource returns a JSON schema for the configuration of the given retention strategy.") public RetentionStrategyDescription configSchema(@ApiParam(name = "strategy", value = "The name of the retention strategy", required = true) @PathParam("strategy") @NotEmpty String strategyName) { return getRetentionStrategyDescription(strategyName); }
@GET @Path("/os") @Timed @ApiOperation(value = "OS information about this node.", notes = "This resource returns information about the operating system this node is running on.") public OsStats osStats() { return statsService.osStats(); }
@GET @Path("strategies/{strategy}") @Timed @ApiOperation(value = "Show JSON schema for configuration of given rotation strategies", notes = "This resource returns a JSON schema for the configuration of the given rotation strategy.") public RotationStrategyDescription configSchema(@ApiParam(name = "strategy", value = "The name of the rotation strategy", required = true) @PathParam("strategy") @NotEmpty String strategyName) { return getRotationStrategyDescription(strategyName); }