/** * Construct a new immutable {@code EventResponse} instance. * @param events The value for the {@code events} attribute * @param index The value for the {@code index} attribute * @return An immutable EventResponse instance */ public static ImmutableEventResponse of(List<Event> events, BigInteger index) { return of((Iterable<? extends Event>) events, index); }
/** * Lists events for the Consul agent. * * GET /v1/event/list?name={name} * * @param name Event name to filter. * @param queryOptions The query options to use. * @return A {@link com.orbitz.consul.model.ConsulResponse} object containing * a list of {@link com.orbitz.consul.model.event.Event} objects. */ public EventResponse listEvents(String name, QueryOptions queryOptions) { Map<String, String> query = StringUtils.isNotEmpty(name) ? ImmutableMap.of("name", name) : Collections.emptyMap(); ConsulResponse<List<Event>> response = http.extractConsulResponse(api.listEvents(query)); return ImmutableEventResponse.of(response.getResponse(), response.getIndex()); }
@Override public void onComplete(ConsulResponse<List<Event>> response) { callback.onComplete(ImmutableEventResponse.of(response.getResponse(), response.getIndex())); }