public abstract class ProxiedResource extends RestResource
| Modifier and Type | Class and Description |
|---|---|
static class |
ProxiedResource.CallResult<ResponseType>
This wrapper is intended to provide additional server error information
if something went wrong beyond the actual API HTTP call.
|
static class |
ProxiedResource.MasterResponse<ResponseType>
Deprecated.
|
static class |
ProxiedResource.NodeResponse<ResponseType> |
| Modifier and Type | Field and Description |
|---|---|
protected String |
authenticationToken |
protected NodeService |
nodeService |
protected RemoteInterfaceProvider |
remoteInterfaceProvider |
configuration, userService| Modifier | Constructor and Description |
|---|---|
protected |
ProxiedResource(javax.ws.rs.core.HttpHeaders httpHeaders,
NodeService nodeService,
RemoteInterfaceProvider remoteInterfaceProvider,
ExecutorService executorService) |
| Modifier and Type | Method and Description |
|---|---|
protected <RemoteInterfaceType> |
createRemoteInterfaceProvider(Class<RemoteInterfaceType> interfaceClass) |
protected <RemoteInterfaceType,RemoteCallResponseType> |
getForAllNodes(Function<RemoteInterfaceType,retrofit2.Call<RemoteCallResponseType>> fn,
Function<String,Optional<RemoteInterfaceType>> interfaceProvider)
Deprecated.
|
protected <RemoteInterfaceType,FinalResponseType,RemoteCallResponseType> |
getForAllNodes(Function<RemoteInterfaceType,retrofit2.Call<RemoteCallResponseType>> fn,
Function<String,Optional<RemoteInterfaceType>> interfaceProvider,
Function<RemoteCallResponseType,FinalResponseType> transformer)
Deprecated.
|
protected <RemoteInterfaceType,RemoteCallResponseType> |
requestOnAllNodes(Function<String,Optional<RemoteInterfaceType>> interfaceProvider,
Function<RemoteInterfaceType,retrofit2.Call<RemoteCallResponseType>> fn) |
protected <RemoteInterfaceType,RemoteCallResponseType,FinalResponseType> |
requestOnAllNodes(Function<String,Optional<RemoteInterfaceType>> remoteInterfaceProvider,
Function<RemoteInterfaceType,retrofit2.Call<RemoteCallResponseType>> remoteInterfaceCallProvider,
Function<RemoteCallResponseType,FinalResponseType> responseTransformer)
This method concurrently performs an API call on all active nodes.
|
protected <RemoteInterfaceType,RemoteCallResponseType> |
requestOnMaster(Function<RemoteInterfaceType,retrofit2.Call<RemoteCallResponseType>> remoteInterfaceFunction,
Function<String,Optional<RemoteInterfaceType>> remoteInterfaceProvider)
Execute the given remote interface function on the master node.
|
checkAnyPermission, checkPermission, checkPermission, getCurrentUser, getIndexSet, getSubject, getUriBuilderToSelf, isAnyPermitted, isAnyPermitted, isPermitted, isPermitted, setPrettyPrintprotected final String authenticationToken
protected final NodeService nodeService
protected final RemoteInterfaceProvider remoteInterfaceProvider
protected ProxiedResource(@Context
javax.ws.rs.core.HttpHeaders httpHeaders,
NodeService nodeService,
RemoteInterfaceProvider remoteInterfaceProvider,
ExecutorService executorService)
@Deprecated protected <RemoteInterfaceType,RemoteCallResponseType> Map<String,Optional<RemoteCallResponseType>> getForAllNodes(Function<RemoteInterfaceType,retrofit2.Call<RemoteCallResponseType>> fn, Function<String,Optional<RemoteInterfaceType>> interfaceProvider)
requestOnAllNodes(Function, Function) instead.
The new method properly handles the case of `No-Content` response and provides
detailed report per each node API call.@Deprecated protected <RemoteInterfaceType,FinalResponseType,RemoteCallResponseType> Map<String,Optional<FinalResponseType>> getForAllNodes(Function<RemoteInterfaceType,retrofit2.Call<RemoteCallResponseType>> fn, Function<String,Optional<RemoteInterfaceType>> interfaceProvider, Function<RemoteCallResponseType,FinalResponseType> transformer)
requestOnAllNodes(Function, Function, Function) instead.
The new method properly handles the case of `No-Content` response and provides
detailed report per each node API call.protected <RemoteInterfaceType> Function<String,Optional<RemoteInterfaceType>> createRemoteInterfaceProvider(Class<RemoteInterfaceType> interfaceClass)
protected <RemoteInterfaceType,RemoteCallResponseType> Map<String,ProxiedResource.CallResult<RemoteCallResponseType>> requestOnAllNodes(Function<String,Optional<RemoteInterfaceType>> interfaceProvider, Function<RemoteInterfaceType,retrofit2.Call<RemoteCallResponseType>> fn)
protected <RemoteInterfaceType,RemoteCallResponseType,FinalResponseType> Map<String,ProxiedResource.CallResult<FinalResponseType>> requestOnAllNodes(Function<String,Optional<RemoteInterfaceType>> remoteInterfaceProvider, Function<RemoteInterfaceType,retrofit2.Call<RemoteCallResponseType>> remoteInterfaceCallProvider, Function<RemoteCallResponseType,FinalResponseType> responseTransformer)
RemoteInterfaceType - Type of the Retrofit HTTP clientRemoteCallResponseType - Type of the API call response bodyFinalResponseType - Type after applying the transformationsremoteInterfaceProvider - provides an instance of Retrofit HTTP client for the target APIremoteInterfaceCallProvider - provides an invocation of a Retrofit method for the intended API call.responseTransformer - applies transformations to HTTP response bodyprotected <RemoteInterfaceType,RemoteCallResponseType> ProxiedResource.MasterResponse<RemoteCallResponseType> requestOnMaster(Function<RemoteInterfaceType,retrofit2.Call<RemoteCallResponseType>> remoteInterfaceFunction, Function<String,Optional<RemoteInterfaceType>> remoteInterfaceProvider) throws IOException
This is used to forward an API request to the master node. It is useful in situations where an API call can only be executed on the master node.
The returned ProxiedResource.MasterResponse object is constructed from the remote response's status code and body.
IOExceptionCopyright © 2012–2021 Graylog, Inc.. All rights reserved.