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

org.keycloak.events.admin.AdminEventQuery Maven / Gradle / Ivy

/*
 * Copyright 2016 Red Hat, Inc. and/or its affiliates
 * and other contributors as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.keycloak.events.admin;

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

/**
 * @author Stian Thorgersen
 */
public interface AdminEventQuery {
    
    /**
     * Search by resource realm
     *
     * @param realmId realm id
     * @return Associated AdminEventQuery for method chaining
     */
    AdminEventQuery realm(String realmId);
    
    /**
     * Search by authentication realm
     *
     * @param realmId realm id
     * @return Associated AdminEventQuery for method chaining
     */
    AdminEventQuery authRealm(String realmId);
    
    /**
     * Search by authenticated client
     *
     * @param clientId client uuid
     * @return Associated AdminEventQuery for method chaining
     */
    AdminEventQuery authClient(String clientId);

    /**
     * Search by authenticated user
     *
     * @param userId user uuid
     * @return Associated AdminEventQuery for method chaining
     */
    AdminEventQuery authUser(String userId);

    /**
     * Search by request ip address
     *
     * @param ipAddress
     * @return Associated AdminEventQuery for method chaining
     */
    AdminEventQuery authIpAddress(String ipAddress);

    /**
     * Search by operation type
     *
     * @param operations
     * @return this for method chaining
     */
    AdminEventQuery operation(OperationType... operations);

    /**
     * Search by {@link ResourceType}.
     * @param resourceTypes
     * @return this for method chaining
     */
    AdminEventQuery resourceType(ResourceType ... resourceTypes);

    /**
     * Search by resource path. Supports wildcard *. For example:
     * 
    *
  • */master - matches 'realms/master'
  • *
  • realms/master/*/00d4b16f - matches 'realms/master/clients/00d4b16f'
  • *
  • realms/master/* - matches anything under 'realms/master'
  • *
* * @param resourcePath * @return this for method chaining */ AdminEventQuery resourcePath(String resourcePath); /** * Search by events after the specified time * * @param fromTime from date * @return this for method chaining */ AdminEventQuery fromTime(Date fromTime); /** * Search by events before the specified time * * @param toTime to date * @return this for method chaining */ AdminEventQuery toTime(Date toTime); /** * Used for pagination * * @param first first result to return * @return this for method chaining */ AdminEventQuery firstResult(int first); /** * Use for pagination * * @param max the maximum results to return * @return this for method chaining */ AdminEventQuery maxResults(int max); /** * Order the result by descending time * * @return this for method chaining */ AdminEventQuery orderByDescTime(); /** * Order the result by ascending time * * @return this for method chaining */ AdminEventQuery orderByAscTime(); /** * Executes the query and returns the results as a stream. * @return Stream of admin events. Never returns {@code null}. */ Stream getResultStream(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy