Search in sources :

Example 1 with LogQuery

use of io.gravitee.rest.api.model.analytics.query.LogQuery in project gravitee-management-rest-api by gravitee-io.

the class ApiHealthResource method getApiHealthCheckLogs.

@GET
@Path("logs")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Health-check logs")
@ApiResponses({ @ApiResponse(code = 200, message = "API logs"), @ApiResponse(code = 500, message = "Internal server error") })
@Permissions({ @Permission(value = RolePermission.API_HEALTH, acls = RolePermissionAction.READ) })
public SearchLogResponse getApiHealthCheckLogs(@BeanParam LogsParam param) {
    param.validate();
    LogQuery logQuery = new LogQuery();
    logQuery.setQuery(param.getQuery());
    logQuery.setPage(param.getPage());
    logQuery.setSize(param.getSize());
    logQuery.setFrom(param.getFrom());
    logQuery.setTo(param.getTo());
    return healthCheckService.findByApi(api, logQuery, param.isTransition());
}
Also used : LogQuery(io.gravitee.rest.api.model.analytics.query.LogQuery) Permissions(io.gravitee.rest.api.management.rest.security.Permissions)

Example 2 with LogQuery

use of io.gravitee.rest.api.model.analytics.query.LogQuery in project gravitee-management-rest-api by gravitee-io.

the class ApplicationLogsResource method getSearchLogResponse.

@SuppressWarnings("unchecked")
protected SearchLogResponse<ApplicationRequestItem> getSearchLogResponse(String applicationId, PaginationParam paginationParam, LogsParam logsParam) {
    logsParam.validate();
    LogQuery logQuery = new LogQuery();
    logQuery.setPage(paginationParam.getPage());
    logQuery.setSize(paginationParam.getSize());
    logQuery.setQuery(logsParam.getQuery());
    logQuery.setFrom(logsParam.getFrom());
    logQuery.setTo(logsParam.getTo());
    logQuery.setField(logsParam.getField());
    logQuery.setOrder(!"DESC".equals(logsParam.getOrder()));
    return logsService.findByApplication(applicationId, logQuery);
}
Also used : LogQuery(io.gravitee.rest.api.model.analytics.query.LogQuery)

Example 3 with LogQuery

use of io.gravitee.rest.api.model.analytics.query.LogQuery in project gravitee-management-rest-api by gravitee-io.

the class PlatformLogsResource method getPlatformLogs.

@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get platform logs", notes = "User must have the MANAGEMENT_PLATFORM[READ] permission to use this service")
@ApiResponses({ @ApiResponse(code = 200, message = "Platform logs", response = SearchLogResponse.class), @ApiResponse(code = 500, message = "Internal server error") })
@Permissions({ @Permission(value = RolePermission.ENVIRONMENT_PLATFORM, acls = RolePermissionAction.READ) })
public SearchLogResponse getPlatformLogs(@BeanParam LogsParam param) {
    param.validate();
    LogQuery logQuery = new LogQuery();
    logQuery.setQuery(param.getQuery());
    logQuery.setPage(param.getPage());
    logQuery.setSize(param.getSize());
    logQuery.setFrom(param.getFrom());
    logQuery.setTo(param.getTo());
    logQuery.setField(param.getField());
    logQuery.setOrder(param.isOrder());
    return logsService.findPlatform(logQuery);
}
Also used : LogQuery(io.gravitee.rest.api.model.analytics.query.LogQuery) ApiOperation(io.swagger.annotations.ApiOperation) Permissions(io.gravitee.rest.api.management.rest.security.Permissions) ApiResponses(io.swagger.annotations.ApiResponses)

Example 4 with LogQuery

use of io.gravitee.rest.api.model.analytics.query.LogQuery in project gravitee-management-rest-api by gravitee-io.

the class ApiLogsResource method getApiLogs.

@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get API logs")
@ApiResponses({ @ApiResponse(code = 200, message = "API logs"), @ApiResponse(code = 500, message = "Internal server error") })
@Permissions({ @Permission(value = RolePermission.API_LOG, acls = RolePermissionAction.READ) })
public SearchLogResponse getApiLogs(@BeanParam LogsParam param) {
    param.validate();
    LogQuery logQuery = new LogQuery();
    logQuery.setQuery(param.getQuery());
    logQuery.setPage(param.getPage());
    logQuery.setSize(param.getSize());
    logQuery.setFrom(param.getFrom());
    logQuery.setTo(param.getTo());
    logQuery.setField(param.getField());
    logQuery.setOrder(param.isOrder());
    return logsService.findByApi(api, logQuery);
}
Also used : LogQuery(io.gravitee.rest.api.model.analytics.query.LogQuery) Permissions(io.gravitee.rest.api.management.rest.security.Permissions)

Example 5 with LogQuery

use of io.gravitee.rest.api.model.analytics.query.LogQuery in project gravitee-management-rest-api by gravitee-io.

the class ApplicationLogsResource method getApplicationLogs.

@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get application logs")
@ApiResponses({ @ApiResponse(code = 200, message = "Application logs"), @ApiResponse(code = 500, message = "Internal server error") })
@Permissions({ @Permission(value = RolePermission.APPLICATION_LOG, acls = RolePermissionAction.READ) })
public SearchLogResponse getApplicationLogs(@BeanParam LogsParam param) {
    param.validate();
    LogQuery logQuery = new LogQuery();
    logQuery.setQuery(param.getQuery());
    logQuery.setPage(param.getPage());
    logQuery.setSize(param.getSize());
    logQuery.setFrom(param.getFrom());
    logQuery.setTo(param.getTo());
    logQuery.setField(param.getField());
    logQuery.setOrder(param.isOrder());
    return logsService.findByApplication(application, logQuery);
}
Also used : LogQuery(io.gravitee.rest.api.model.analytics.query.LogQuery) Permissions(io.gravitee.rest.api.management.rest.security.Permissions)

Aggregations

LogQuery (io.gravitee.rest.api.model.analytics.query.LogQuery)6 Permissions (io.gravitee.rest.api.management.rest.security.Permissions)4 SearchLogResponse (io.gravitee.rest.api.model.log.SearchLogResponse)1 Links (io.gravitee.rest.api.portal.rest.model.Links)1 LogsResponse (io.gravitee.rest.api.portal.rest.model.LogsResponse)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 MultivaluedMap (javax.ws.rs.core.MultivaluedMap)1 Response (javax.ws.rs.core.Response)1 Test (org.junit.Test)1