InstanceAdminLogApi.java
/***************************************************************************
Copyright 2015 Emily Estes
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 net.metanotion.multitenant.adminapp;
import java.util.List;
import javax.inject.Named;
import org.joda.time.ReadableInstant;
import net.metanotion.util.Json;
import net.metanotion.util.Nullable;
import net.metanotion.web.HttpGet;
/** This is the API for reviewing and managing the logs of per tenant instance administrative actions. */
public interface InstanceAdminLogApi {
/** Retrieve the JSON description of this API endpoint.
@param tenantId The tenant instance identifier.
@return A JSON object describing the API.
*/
@HttpGet @Json public Object adminLogApi(@Named(Constants.TENANT_ID) long tenantId);
/** HTTP Response for returning a list of events as a JSON object. */
public static final class LogList {
/** The list of events. */
public final List<LogStruct> events;
/** Create a new event list object.
@param events list of events.
*/
public LogList(final List<LogStruct> events) { this.events = events; }
}
/** Retrieve a list of administrative event log records.
@param tenantId The tenant instance identifier.
@param startEventId The id of the event number to start the search at, or 0 to start at the most recevent
event.
@param count The maxmimum number of event records to return.
@param email Limit search to records involving this username, or null for anyone.
@param startDate Limit search to records after this date.
@param endDate Limit search to records before this date.
@return A list of event log records.
@throws Exception if the operation could not be performed.
*/
@HttpGet @Json public LogList searchLogs(@Named(Constants.TENANT_ID) long tenantId,
@Named("startEventId") long startEventId,
@Named("count") int count,
@Named(Constants.EMAIL) @Nullable String email,
@Named("startDate") @Nullable ReadableInstant startDate,
@Named("endDate") @Nullable ReadableInstant endDate) throws Exception;
}