All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gitlab4j.api.AuditEventApi Maven / Gradle / Ivy

Go to download

GitLab4J-API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories and servers via the GitLab REST API.

There is a newer version: 6.0.0-rc.6
Show newest version
package org.gitlab4j.api;

import java.util.Date;
import java.util.List;
import java.util.stream.Stream;

import javax.ws.rs.core.Form;
import javax.ws.rs.core.Response;

import org.gitlab4j.api.models.AuditEvent;
import org.gitlab4j.api.utils.ISO8601;

/**
 * This class implements the client side API for the GitLab Instance Audit Event API.
 * See Audit Event API at GitLab for more information.
 */
public class AuditEventApi extends AbstractApi {

    public AuditEventApi(GitLabApi gitLabApi) {
        super(gitLabApi);
    }

    /**
     * Get a List of the group audit events viewable by Maintainer or an Owner of the group.
     *
     * 
GET /audit_events/
* * @param created_after Return group audit events created on or after the given time. * @param created_before Return group audit events created on or before the given time. * @param entityType Return audit events for the given entity type. Valid values are: User, Group, or Project. * @param entityId Return audit events for the given entity ID. Requires entityType attribute to be present. * @return a List of group Audit events * @throws GitLabApiException if any exception occurs */ public List getAuditEvents(Date created_after, Date created_before, String entityType, Long entityId) throws GitLabApiException { return (getAuditEvents(created_after, created_before, entityType, entityId, getDefaultPerPage()).all()); } /** * Get a Pager of the group audit events viewable by Maintainer or an Owner of the group. * *
GET /audit_events
* * @param created_after Return group audit events created on or after the given time. * @param created_before Return group audit events created on or before the given time. * @param entityType Return audit events for the given entity type. Valid values are: User, Group, or Project. * @param entityId Return audit events for the given entity ID. Requires entityType attribute to be present. * @param itemsPerPage the number of Audit Event instances that will be fetched per page * @return a Pager of group Audit events * @throws GitLabApiException if any exception occurs */ public Pager getAuditEvents(Date created_after, Date created_before, String entityType, Long entityId, int itemsPerPage) throws GitLabApiException { Form form = new GitLabApiForm() .withParam("created_before", ISO8601.toString(created_before, false)) .withParam("created_after", ISO8601.toString(created_after, false)) .withParam("entity_type", entityType) .withParam("entity_id", entityId); return (new Pager(this, AuditEvent.class, itemsPerPage, form.asMap(), "audit_events")); } /** * Get a Stream of the group audit events viewable by Maintainer or an Owner of the group. * *
GET /audit_events
* * @param created_after Return group audit events created on or after the given time. * @param created_before Return group audit events created on or before the given time. * @param entityType Return audit events for the given entity type. Valid values are: User, Group, or Project. * @param entityId Return audit events for the given entity ID. Requires entityType attribute to be present. * @return a Stream of group Audit events * @throws GitLabApiException if any exception occurs */ public Stream getAuditEventsStream(Date created_after, Date created_before, String entityType, Long entityId) throws GitLabApiException { return (getAuditEvents(created_after, created_before, entityType, entityId, getDefaultPerPage()).stream()); } /** * Get a specific instance audit event. * *
GitLab Endpoint: GET /audit_events/:id
* * @param auditEventId the auditEventId, required * @return the group Audit event * @throws GitLabApiException if any exception occurs */ public AuditEvent getAuditEvent(Long auditEventId) throws GitLabApiException { Response response = get(Response.Status.OK, null, "audit_events", auditEventId); return (response.readEntity(AuditEvent.class)); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy