use of io.gravitee.management.model.audit.AuditQuery in project gravitee-management-rest-api by gravitee-io.
the class AuditResource method list.
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Permissions({ @Permission(value = RolePermission.MANAGEMENT_AUDIT, acls = RolePermissionAction.READ) })
public MetadataPage<AuditEntity> list(@BeanParam AuditParam param) {
AuditQuery query = new AuditQuery();
query.setFrom(param.getFrom());
query.setTo(param.getTo());
query.setPage(param.getPage());
query.setSize(param.getSize());
if (param.isManagementLogsOnly()) {
query.setManagementLogsOnly(true);
} else {
if (param.getApiId() != null) {
query.setApiIds(Collections.singletonList(param.getApiId()));
}
if (param.getApplicationId() != null) {
query.setApplicationIds(Collections.singletonList(param.getApplicationId()));
}
}
if (param.getEvent() != null) {
query.setEvents(Collections.singletonList(param.getEvent()));
}
return auditService.search(query);
}
use of io.gravitee.management.model.audit.AuditQuery in project gravitee-management-rest-api by gravitee-io.
the class ApiAuditResource method list.
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Permissions({ @Permission(value = RolePermission.API_AUDIT, acls = RolePermissionAction.READ) })
public MetadataPage<AuditEntity> list(@PathParam("api") String api, @BeanParam AuditParam param) {
AuditQuery query = new AuditQuery();
query.setFrom(param.getFrom());
query.setTo(param.getTo());
query.setPage(param.getPage());
query.setSize(param.getSize());
query.setApiIds(Collections.singletonList(api));
query.setApplicationIds(Collections.emptyList());
query.setManagementLogsOnly(false);
if (param.getEvent() != null) {
query.setEvents(Collections.singletonList(param.getEvent()));
}
return auditService.search(query);
}
Aggregations