Class AbstractApiAction
- java.lang.Object
-
- org.elasticsearch.rest.BaseRestHandler
-
- com.floragunn.searchguard.dlic.rest.api.AbstractApiAction
-
- All Implemented Interfaces:
org.elasticsearch.rest.RestHandler
- Direct Known Subclasses:
AuthTokenProcessorAction,FlushCacheApiAction,LicenseApiAction,PatchableResourceApiAction
public abstract class AbstractApiAction extends org.elasticsearch.rest.BaseRestHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected BooleanacceptInvalidLicenseprotected com.floragunn.searchguard.auditlog.AuditLogauditLogprotected com.floragunn.searchguard.configuration.ConfigurationRepositoryclprotected org.elasticsearch.cluster.service.ClusterServicecsprotected org.apache.logging.log4j.Loggerlogprotected org.elasticsearch.common.settings.Settingssettingsprotected com.floragunn.searchguard.sgconf.StaticSgConfigstaticSgConfig
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractApiAction(org.elasticsearch.common.settings.Settings settings, Path configPath, org.elasticsearch.rest.RestController controller, org.elasticsearch.client.Client client, com.floragunn.searchguard.configuration.AdminDNs adminDNs, com.floragunn.searchguard.configuration.ConfigurationRepository cl, com.floragunn.searchguard.sgconf.StaticSgConfig staticSgConfig, org.elasticsearch.cluster.service.ClusterService cs, com.floragunn.searchguard.ssl.transport.PrincipalExtractor principalExtractor, com.floragunn.searchguard.privileges.PrivilegesEvaluator evaluator, com.floragunn.searchguard.privileges.SpecialPrivilegesEvaluationContextProviderRegistry specialPrivilegesEvaluationContextProviderRegistry, org.elasticsearch.threadpool.ThreadPool threadPool, com.floragunn.searchguard.auditlog.AuditLog auditLog)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidbadRequestResponse(org.elasticsearch.rest.RestChannel channel, AbstractConfigurationValidator validator)protected voidbadRequestResponse(org.elasticsearch.rest.RestChannel channel, String message)protected booleancheckConfigUpdateResponse(com.floragunn.searchguard.action.configupdate.ConfigUpdateResponse response)protected voidconsumeParameters(org.elasticsearch.rest.RestRequest request)Consume all defined parameters for the request.protected static org.elasticsearch.common.xcontent.XContentBuilderconvertToJson(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.common.xcontent.ToXContent toxContent)protected voidcreatedResponse(org.elasticsearch.rest.RestChannel channel, String message)protected booleanensureIndexExists()protected voidfilter(com.floragunn.searchguard.sgconf.impl.SgDynamicConfiguration<?> builder)protected voidforbidden(org.elasticsearch.rest.RestChannel channel, String message)protected abstract com.floragunn.searchguard.sgconf.impl.CTypegetConfigName()protected abstract EndpointgetEndpoint()StringgetName()protected abstract StringgetResourceName()protected abstract AbstractConfigurationValidatorgetValidator(org.elasticsearch.rest.RestRequest request, org.elasticsearch.common.bytes.BytesReference ref, Object... params)protected voidhandleApiRequest(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.rest.RestRequest request, org.elasticsearch.client.Client client)protected voidhandleDelete(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.rest.RestRequest request, org.elasticsearch.client.Client client, com.fasterxml.jackson.databind.JsonNode content)protected voidhandleGet(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.rest.RestRequest request, org.elasticsearch.client.Client client, com.fasterxml.jackson.databind.JsonNode content)protected voidhandlePost(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.rest.RestRequest request, org.elasticsearch.client.Client client, com.fasterxml.jackson.databind.JsonNode content)protected voidhandlePut(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.rest.RestRequest request, org.elasticsearch.client.Client client, com.fasterxml.jackson.databind.JsonNode content)protected voidinternalErrorResponse(org.elasticsearch.rest.RestChannel channel, String message)protected booleanisHidden(com.floragunn.searchguard.sgconf.impl.SgDynamicConfiguration<?> configuration, String resourceName)protected booleanisReserved(com.floragunn.searchguard.sgconf.impl.SgDynamicConfiguration<?> configuration, String resourceName)protected booleanisStatic(com.floragunn.searchguard.sgconf.impl.SgDynamicConfiguration<?> configuration, String resourceName)protected com.floragunn.searchguard.sgconf.impl.SgDynamicConfiguration<?>load(com.floragunn.searchguard.sgconf.impl.CType config, boolean logComplianceEvent)protected voidnotFound(org.elasticsearch.rest.RestChannel channel, String message)protected voidnotImplemented(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.rest.RestRequest.Method method)protected org.elasticsearch.rest.BaseRestHandler.RestChannelConsumerprepareRequest(org.elasticsearch.rest.RestRequest request, org.elasticsearch.client.node.NodeClient client)protected voidresponse(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.rest.RestStatus status, String message)protected voidsaveAnUpdateConfigs(org.elasticsearch.client.Client client, org.elasticsearch.rest.RestRequest request, com.floragunn.searchguard.sgconf.impl.CType cType, com.floragunn.searchguard.sgconf.impl.SgDynamicConfiguration<?> configuration, com.floragunn.searchguard.dlic.rest.api.AbstractApiAction.OnSucessActionListener<org.elasticsearch.action.index.IndexResponse> actionListener)protected voidsuccessResponse(org.elasticsearch.rest.RestChannel channel, com.floragunn.searchguard.action.licenseinfo.LicenseInfoResponse ur)protected voidsuccessResponse(org.elasticsearch.rest.RestChannel channel, com.floragunn.searchguard.sgconf.impl.SgDynamicConfiguration<?> response)protected voidsuccessResponse(org.elasticsearch.rest.RestChannel channel, String message)protected voidunprocessable(org.elasticsearch.rest.RestChannel channel, String message)-
Methods inherited from class org.elasticsearch.rest.BaseRestHandler
getUsageCount, handleRequest, responseParams, routes, unrecognized
-
-
-
-
Field Detail
-
log
protected final org.apache.logging.log4j.Logger log
-
cl
protected final com.floragunn.searchguard.configuration.ConfigurationRepository cl
-
cs
protected final org.elasticsearch.cluster.service.ClusterService cs
-
acceptInvalidLicense
protected final Boolean acceptInvalidLicense
-
auditLog
protected final com.floragunn.searchguard.auditlog.AuditLog auditLog
-
settings
protected final org.elasticsearch.common.settings.Settings settings
-
staticSgConfig
protected final com.floragunn.searchguard.sgconf.StaticSgConfig staticSgConfig
-
-
Constructor Detail
-
AbstractApiAction
protected AbstractApiAction(org.elasticsearch.common.settings.Settings settings, Path configPath, org.elasticsearch.rest.RestController controller, org.elasticsearch.client.Client client, com.floragunn.searchguard.configuration.AdminDNs adminDNs, com.floragunn.searchguard.configuration.ConfigurationRepository cl, com.floragunn.searchguard.sgconf.StaticSgConfig staticSgConfig, org.elasticsearch.cluster.service.ClusterService cs, com.floragunn.searchguard.ssl.transport.PrincipalExtractor principalExtractor, com.floragunn.searchguard.privileges.PrivilegesEvaluator evaluator, com.floragunn.searchguard.privileges.SpecialPrivilegesEvaluationContextProviderRegistry specialPrivilegesEvaluationContextProviderRegistry, org.elasticsearch.threadpool.ThreadPool threadPool, com.floragunn.searchguard.auditlog.AuditLog auditLog)
-
-
Method Detail
-
getValidator
protected abstract AbstractConfigurationValidator getValidator(org.elasticsearch.rest.RestRequest request, org.elasticsearch.common.bytes.BytesReference ref, Object... params)
-
getResourceName
protected abstract String getResourceName()
-
getConfigName
protected abstract com.floragunn.searchguard.sgconf.impl.CType getConfigName()
-
handleApiRequest
protected void handleApiRequest(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.rest.RestRequest request, org.elasticsearch.client.Client client) throws IOException- Throws:
IOException
-
handleDelete
protected void handleDelete(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.rest.RestRequest request, org.elasticsearch.client.Client client, com.fasterxml.jackson.databind.JsonNode content) throws IOException- Throws:
IOException
-
handlePut
protected void handlePut(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.rest.RestRequest request, org.elasticsearch.client.Client client, com.fasterxml.jackson.databind.JsonNode content) throws IOException- Throws:
IOException
-
handlePost
protected void handlePost(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.rest.RestRequest request, org.elasticsearch.client.Client client, com.fasterxml.jackson.databind.JsonNode content) throws IOException- Throws:
IOException
-
handleGet
protected void handleGet(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.rest.RestRequest request, org.elasticsearch.client.Client client, com.fasterxml.jackson.databind.JsonNode content) throws IOException- Throws:
IOException
-
load
protected final com.floragunn.searchguard.sgconf.impl.SgDynamicConfiguration<?> load(com.floragunn.searchguard.sgconf.impl.CType config, boolean logComplianceEvent)
-
ensureIndexExists
protected boolean ensureIndexExists()
-
filter
protected void filter(com.floragunn.searchguard.sgconf.impl.SgDynamicConfiguration<?> builder)
-
saveAnUpdateConfigs
protected void saveAnUpdateConfigs(org.elasticsearch.client.Client client, org.elasticsearch.rest.RestRequest request, com.floragunn.searchguard.sgconf.impl.CType cType, com.floragunn.searchguard.sgconf.impl.SgDynamicConfiguration<?> configuration, com.floragunn.searchguard.dlic.rest.api.AbstractApiAction.OnSucessActionListener<org.elasticsearch.action.index.IndexResponse> actionListener)
-
prepareRequest
protected final org.elasticsearch.rest.BaseRestHandler.RestChannelConsumer prepareRequest(org.elasticsearch.rest.RestRequest request, org.elasticsearch.client.node.NodeClient client) throws IOException- Specified by:
prepareRequestin classorg.elasticsearch.rest.BaseRestHandler- Throws:
IOException
-
checkConfigUpdateResponse
protected boolean checkConfigUpdateResponse(com.floragunn.searchguard.action.configupdate.ConfigUpdateResponse response)
-
convertToJson
protected static org.elasticsearch.common.xcontent.XContentBuilder convertToJson(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.common.xcontent.ToXContent toxContent)
-
response
protected void response(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.rest.RestStatus status, String message)
-
successResponse
protected void successResponse(org.elasticsearch.rest.RestChannel channel, com.floragunn.searchguard.sgconf.impl.SgDynamicConfiguration<?> response)
-
successResponse
protected void successResponse(org.elasticsearch.rest.RestChannel channel, com.floragunn.searchguard.action.licenseinfo.LicenseInfoResponse ur)
-
badRequestResponse
protected void badRequestResponse(org.elasticsearch.rest.RestChannel channel, AbstractConfigurationValidator validator)
-
successResponse
protected void successResponse(org.elasticsearch.rest.RestChannel channel, String message)
-
createdResponse
protected void createdResponse(org.elasticsearch.rest.RestChannel channel, String message)
-
badRequestResponse
protected void badRequestResponse(org.elasticsearch.rest.RestChannel channel, String message)
-
notFound
protected void notFound(org.elasticsearch.rest.RestChannel channel, String message)
-
forbidden
protected void forbidden(org.elasticsearch.rest.RestChannel channel, String message)
-
internalErrorResponse
protected void internalErrorResponse(org.elasticsearch.rest.RestChannel channel, String message)
-
unprocessable
protected void unprocessable(org.elasticsearch.rest.RestChannel channel, String message)
-
notImplemented
protected void notImplemented(org.elasticsearch.rest.RestChannel channel, org.elasticsearch.rest.RestRequest.Method method)
-
isReserved
protected final boolean isReserved(com.floragunn.searchguard.sgconf.impl.SgDynamicConfiguration<?> configuration, String resourceName)
-
isHidden
protected final boolean isHidden(com.floragunn.searchguard.sgconf.impl.SgDynamicConfiguration<?> configuration, String resourceName)
-
isStatic
protected final boolean isStatic(com.floragunn.searchguard.sgconf.impl.SgDynamicConfiguration<?> configuration, String resourceName)
-
consumeParameters
protected void consumeParameters(org.elasticsearch.rest.RestRequest request)
Consume all defined parameters for the request. Before we handle the request in subclasses where we actually need the parameter, some global checks are performed, e.g. check whether the SG index exists. Thus, the parameter(s) have not been consumed, and ES will always return a 400 with an internal error message.- Parameters:
request-
-
getName
public String getName()
- Specified by:
getNamein classorg.elasticsearch.rest.BaseRestHandler
-
getEndpoint
protected abstract Endpoint getEndpoint()
-
-