Java Code Examples for org.elasticsearch.rest.RestController#registerHandler()

The following examples show how to use org.elasticsearch.rest.RestController#registerHandler() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionGroupsApiAction.java    From deprecated-security-advanced-modules with Apache License 2.0 6 votes vote down vote up
@Inject
public ActionGroupsApiAction(final Settings settings, final Path configPath, final RestController controller, final Client client,
							 final AdminDNs adminDNs, final ConfigurationRepository cl, final ClusterService cs,
							 final PrincipalExtractor principalExtractor, final PrivilegesEvaluator evaluator, ThreadPool threadPool, AuditLog auditLog) {
	super(settings, configPath, controller, client, adminDNs, cl, cs, principalExtractor, evaluator, threadPool, auditLog);

	// legacy mapping for backwards compatibility
	// TODO: remove in next version
	controller.registerHandler(Method.GET, "/_opendistro/_security/api/actiongroup/{name}", this);
	controller.registerHandler(Method.GET, "/_opendistro/_security/api/actiongroup/", this);
	controller.registerHandler(Method.DELETE, "/_opendistro/_security/api/actiongroup/{name}", this);
	controller.registerHandler(Method.PUT, "/_opendistro/_security/api/actiongroup/{name}", this);

	// corrected mapping, introduced in Open Distro Security
	controller.registerHandler(Method.GET, "/_opendistro/_security/api/actiongroups/{name}", this);
	controller.registerHandler(Method.GET, "/_opendistro/_security/api/actiongroups/", this);
	controller.registerHandler(Method.DELETE, "/_opendistro/_security/api/actiongroups/{name}", this);
	controller.registerHandler(Method.PUT, "/_opendistro/_security/api/actiongroups/{name}", this);
	controller.registerHandler(Method.PATCH, "/_opendistro/_security/api/actiongroups/", this);
	controller.registerHandler(Method.PATCH, "/_opendistro/_security/api/actiongroups/{name}", this);

}
 
Example 2
Source File: RestIndexPutAliasAction.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Inject
public RestIndexPutAliasAction(Settings settings, RestController controller, Client client) {
    super(settings, controller, client);
    controller.registerHandler(PUT, "/{index}/_alias/{name}", this);
    controller.registerHandler(PUT, "/_alias/{name}", this);
    controller.registerHandler(PUT, "/{index}/_aliases/{name}", this);
    controller.registerHandler(PUT, "/_aliases/{name}", this);
    controller.registerHandler(PUT, "/{index}/_alias", this);
    controller.registerHandler(PUT, "/_alias", this);

    controller.registerHandler(POST, "/{index}/_alias/{name}", this);
    controller.registerHandler(POST, "/_alias/{name}", this);
    controller.registerHandler(POST, "/{index}/_aliases/{name}", this);
    controller.registerHandler(POST, "/_aliases/{name}", this);
    controller.registerHandler(PUT, "/{index}/_aliases", this);
    //we cannot add POST for "/_aliases" because this is the _aliases api already defined in RestIndicesAliasesAction
}
 
Example 3
Source File: CSVRestSearchAction.java    From elasticsearch-csv with Apache License 2.0 6 votes vote down vote up
@Inject
public CSVRestSearchAction(Settings settings, Client client, RestController controller) {
    super(settings, controller, client);
    controller.registerHandler(GET, "/_search_csv", this);
    controller.registerHandler(POST, "/_search_csv", this);
    controller.registerHandler(GET, "/{index}/_search_csv", this);
    controller.registerHandler(POST, "/{index}/_search_csv", this);
    controller.registerHandler(GET, "/{index}/{type}/_search_csv", this);
    controller.registerHandler(POST, "/{index}/{type}/_search_csv", this);
    controller.registerHandler(GET, "/_search_csv/template", this);
    controller.registerHandler(POST, "/_search_csv/template", this);
    controller.registerHandler(GET, "/{index}/_search_csv/template", this);
    controller.registerHandler(POST, "/{index}/_search_csv/template", this);
    controller.registerHandler(GET, "/{index}/{type}/_search_csv/template", this);
    controller.registerHandler(POST, "/{index}/{type}/_search_csv/template", this);
}
 
Example 4
Source File: ReindexRestAction.java    From elasticsearch-reindexing with Apache License 2.0 6 votes vote down vote up
@Inject
public ReindexRestAction(final Settings settings, final Client client,
        final RestController restController,
        final ReindexingService reindexingService) {
    super(settings, restController, client);
    this.reindexingService = reindexingService;

    restController.registerHandler(RestRequest.Method.GET,
            "/_reindex", this);
    restController.registerHandler(RestRequest.Method.GET,
            "/_reindex/{name}", this);

    restController.registerHandler(RestRequest.Method.POST,
            "/{index}/{type}/_reindex/{toindex}/{totype}", this);
    restController.registerHandler(RestRequest.Method.POST,
            "/{index}/{type}/_reindex/{toindex}", this);
    restController.registerHandler(RestRequest.Method.POST,
            "/{index}/_reindex/{toindex}/{totype}", this);
    restController.registerHandler(RestRequest.Method.POST,
            "/{index}/_reindex/{toindex}", this);

    restController.registerHandler(RestRequest.Method.DELETE,
            "/_reindex/{name}", this);
}
 
Example 5
Source File: JobRestHandler.java    From elasticsearch-rest-command with The Unlicense 5 votes vote down vote up
@Inject
public JobRestHandler(Settings settings, Client client,
		RestController controller) {
	super(settings, controller, client);
	controller.registerHandler(GET, "/_commandjob", this);
	controller.registerHandler(POST, "/_commandjob", this);
	controller.registerHandler(GET, "/jobs/{jobid}/{type}", this);
	controller.registerHandler(POST, "/jobs/{jobid}/{type}", this);
}
 
Example 6
Source File: TenantsApiAction.java    From deprecated-security-advanced-modules with Apache License 2.0 5 votes vote down vote up
@Inject
public TenantsApiAction(final Settings settings, final Path configPath, final RestController controller, final Client client,
                        final AdminDNs adminDNs, final ConfigurationRepository cl, final ClusterService cs,
                        final PrincipalExtractor principalExtractor, final PrivilegesEvaluator evaluator, ThreadPool threadPool, AuditLog auditLog) {
    super(settings, configPath, controller, client, adminDNs, cl, cs, principalExtractor, evaluator, threadPool, auditLog);

    // corrected mapping, introduced in SG6
    controller.registerHandler(Method.GET, "/_opendistro/_security/api/tenants/{name}", this);
    controller.registerHandler(Method.GET, "/_opendistro/_security/api/tenants/", this);
    controller.registerHandler(Method.DELETE, "/_opendistro/_security/api/tenants/{name}", this);
    controller.registerHandler(Method.PUT, "/_opendistro/_security/api/tenants/{name}", this);
    controller.registerHandler(Method.PATCH, "/_opendistro/_security/api/tenants/", this);
    controller.registerHandler(Method.PATCH, "/_opendistro/_security/api/tenants/{name}", this);

}
 
Example 7
Source File: PermissionsInfoAction.java    From deprecated-security-advanced-modules with Apache License 2.0 5 votes vote down vote up
protected PermissionsInfoAction(final Settings settings, final Path configPath, final RestController controller, final Client client,
		final AdminDNs adminDNs, final ConfigurationRepository cl, final ClusterService cs,
		final PrincipalExtractor principalExtractor, final PrivilegesEvaluator privilegesEvaluator, ThreadPool threadPool, AuditLog auditLog) {
	super(settings);
	controller.registerHandler(Method.GET, "/_opendistro/_security/api/permissionsinfo", this);
	this.threadPool = threadPool;
	this.privilegesEvaluator = privilegesEvaluator;
	this.restApiPrivilegesEvaluator = new RestApiPrivilegesEvaluator(settings, adminDNs, privilegesEvaluator, principalExtractor, configPath, threadPool);
}
 
Example 8
Source File: ResourceListingRequestHandler.java    From swagger-for-elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public ResourceListingRequestHandler(Settings settings, Client client, RestController controller) {
    super(settings, controller, client);
    controller.registerHandler(GET, API_DOCS_PATH + "/v1.2", this);
    controller.registerHandler(GET, API_DOCS_PATH + "/index/{index}/v1.2/", this);
    controller.registerHandler(GET, API_DOCS_PATH + "/alias/{alias}/v1.2/", this);
}
 
Example 9
Source File: ClusteringAction.java    From elasticsearch-carrot2 with Apache License 2.0 5 votes vote down vote up
public RestClusteringAction(RestController controller) {
   controller.registerHandler(POST, "/" + NAME, this);
   controller.registerHandler(POST, "/{index}/" + NAME, this);
   controller.registerHandler(POST, "/{index}/{type}/" + NAME, this);

   controller.registerHandler(GET, "/" + NAME, this);
   controller.registerHandler(GET, "/{index}/" + NAME, this);
   controller.registerHandler(GET, "/{index}/{type}/" + NAME, this);
}
 
Example 10
Source File: FlushCacheApiAction.java    From deprecated-security-advanced-modules with Apache License 2.0 5 votes vote down vote up
@Inject
public FlushCacheApiAction(final Settings settings, final Path configPath, final RestController controller, final Client client,
		final AdminDNs adminDNs, final ConfigurationRepository cl, final ClusterService cs,
           final PrincipalExtractor principalExtractor, final PrivilegesEvaluator evaluator, ThreadPool threadPool, AuditLog auditLog) {
	super(settings, configPath, controller, client, adminDNs, cl, cs, principalExtractor, evaluator, threadPool, auditLog);
	controller.registerHandler(Method.DELETE, "/_opendistro/_security/api/cache", this);
	controller.registerHandler(Method.GET, "/_opendistro/_security/api/cache", this);
	controller.registerHandler(Method.PUT, "/_opendistro/_security/api/cache", this);
	controller.registerHandler(Method.POST, "/_opendistro/_security/api/cache", this);
}
 
Example 11
Source File: S3ManageAction.java    From es-amazon-s3-river with Apache License 2.0 5 votes vote down vote up
@Inject
public S3ManageAction(Settings settings, Client client, RestController controller){
   super(settings, controller, client);

   // Define S3 REST endpoints.
   controller.registerHandler(Method.GET, "/_s3/{rivername}/{command}", this);
}
 
Example 12
Source File: ModelsAction.java    From zentity with Apache License 2.0 5 votes vote down vote up
@Inject
public ModelsAction(RestController controller) {
    controller.registerHandler(GET, "_zentity/models", this);
    controller.registerHandler(GET, "_zentity/models/{entity_type}", this);
    controller.registerHandler(POST, "_zentity/models/{entity_type}", this);
    controller.registerHandler(PUT, "_zentity/models/{entity_type}", this);
    controller.registerHandler(DELETE, "_zentity/models/{entity_type}", this);
}
 
Example 13
Source File: TaskRestHandler.java    From elasticsearch-rest-command with The Unlicense 5 votes vote down vote up
@Inject
public TaskRestHandler(Settings settings, Client client,
		RestController controller) {
	super(settings, controller, client);
	this.client = client;
	controller.registerHandler(GET, "/_task", this);
	controller.registerHandler(POST, "/_task", this);
	controller.registerHandler(GET, "/_taskstatus/{taskid}", this);
}
 
Example 14
Source File: RestGathererAction.java    From elasticsearch-gatherer with Apache License 2.0 4 votes vote down vote up
@Inject
public RestGathererAction(Settings settings, Client client, RestController controller) {
    super(settings, client);
    controller.registerHandler(RestRequest.Method.GET, "/_gatherer", this);
}
 
Example 15
Source File: RestRestoreAction.java    From elasticsearch-inout-plugin with Apache License 2.0 4 votes vote down vote up
@Override
protected void registerHandlers(RestController controller) {
    controller.registerHandler(POST, "/_restore", this);
    controller.registerHandler(POST, "/{index}/_restore", this);
    controller.registerHandler(POST, "/{index}/{type}/_restore", this);
}
 
Example 16
Source File: RestAddNodesAction.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Inject
public RestAddNodesAction(Settings settings, RestController controller, Client client) {
    super(settings, controller, client);
    controller.registerHandler(Method.PUT, "/_nodes/{nodeIpPort}", this);
    controller.registerHandler(Method.POST, "/_nodes/{nodeIpPort}", this);
}
 
Example 17
Source File: ApiDeclarationRequestHandler.java    From swagger-for-elasticsearch with Apache License 2.0 4 votes vote down vote up
@Inject
public ApiDeclarationRequestHandler(Settings settings, Client client, RestController controller) {
    super(settings, controller, client);
    controller.registerHandler(GET, API_DOCS_PATH + "/v1.2/{resource}", this);
    controller.registerHandler(GET, API_DOCS_PATH + "/{indexOrAlias}/v1.2/{resource}", this);
}
 
Example 18
Source File: RestDumpAction.java    From elasticsearch-inout-plugin with Apache License 2.0 4 votes vote down vote up
@Override
protected void registerHandlers(RestController controller) {
    controller.registerHandler(POST, "/_dump", this);
    controller.registerHandler(POST, "/{index}/_dump", this);
    controller.registerHandler(POST, "/{index}/{type}/_dump", this);
}
 
Example 19
Source File: RestStatsFilterJoinCacheAction.java    From siren-join with GNU Affero General Public License v3.0 4 votes vote down vote up
@Inject
public RestStatsFilterJoinCacheAction(final Settings settings, final RestController controller, final Client client) {
  super(settings, controller, client);
  controller.registerHandler(RestRequest.Method.POST, "/_filter_join/cache/stats", this);
  controller.registerHandler(RestRequest.Method.GET, "/_filter_join/cache/stats", this);
}
 
Example 20
Source File: OpenDistroSecurityConfigAction.java    From deprecated-security-advanced-modules with Apache License 2.0 4 votes vote down vote up
@Inject
public OpenDistroSecurityConfigAction(final Settings settings, final Path configPath, final RestController controller, final Client client,
                      final AdminDNs adminDNs, final ConfigurationRepository cl, final ClusterService cs,
                      final PrincipalExtractor principalExtractor, final PrivilegesEvaluator evaluator, ThreadPool threadPool, AuditLog auditLog) {
    super(settings, configPath, controller, client, adminDNs, cl, cs, principalExtractor, evaluator, threadPool, auditLog);

    allowPutOrPatch = settings.getAsBoolean(ConfigConstants.OPENDISTRO_SECURITY_UNSUPPORTED_RESTAPI_ALLOW_SECURITYCONFIG_MODIFICATION, false);


    controller.registerHandler(Method.GET, "/_opendistro/_security/api/securityconfig/", this);

    //controller.registerHandler(Method.GET, "/_opendistro/_security/api/config/", this);

    if(allowPutOrPatch) {

        //deprecated, will be removed with ODFE 8, use opendistro_security_config instead of config
        controller.registerHandler(Method.PUT, "/_opendistro/_security/api/securityconfig/{name}", this);
        controller.registerHandler(Method.PATCH, "/_opendistro/_security/api/securityconfig/", this);


    }
}