29
29
import org .elasticsearch .client .security .ClearRolesCacheResponse ;
30
30
import org .elasticsearch .client .security .CreateTokenRequest ;
31
31
import org .elasticsearch .client .security .CreateTokenResponse ;
32
+ import org .elasticsearch .client .security .DeletePrivilegesRequest ;
33
+ import org .elasticsearch .client .security .DeletePrivilegesResponse ;
32
34
import org .elasticsearch .client .security .DeleteRoleMappingRequest ;
33
35
import org .elasticsearch .client .security .DeleteRoleMappingResponse ;
34
36
import org .elasticsearch .client .security .DeleteRoleRequest ;
@@ -221,7 +223,7 @@ public void disableUserAsync(DisableUserRequest request, RequestOptions options,
221
223
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html">
222
224
* the docs</a> for more.
223
225
*
224
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
226
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
225
227
* @return the responsee from the authenticate user call
226
228
*/
227
229
public AuthenticateResponse authenticate (RequestOptions options ) throws IOException {
@@ -234,8 +236,8 @@ public AuthenticateResponse authenticate(RequestOptions options) throws IOExcept
234
236
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html">
235
237
* the docs</a> for more.
236
238
*
237
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
238
- * @param listener the listener to be notified upon request completion
239
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
240
+ * @param listener the listener to be notified upon request completion
239
241
*/
240
242
public void authenticateAsync (RequestOptions options , ActionListener <AuthenticateResponse > listener ) {
241
243
restHighLevelClient .performRequestAsyncAndParseEntity (AuthenticateRequest .INSTANCE , AuthenticateRequest ::getRequest , options ,
@@ -473,4 +475,32 @@ public void invalidateTokenAsync(InvalidateTokenRequest request, RequestOptions
473
475
InvalidateTokenResponse ::fromXContent , listener , emptySet ());
474
476
}
475
477
478
+ /**
479
+ * Removes application privilege(s)
480
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-privilege.html">
481
+ * the docs</a> for more.
482
+ * @param request the request with the application privilege to delete
483
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
484
+ * @return the response from the delete application privilege call
485
+ * @throws IOException in case there is a problem sending the request or parsing back the response
486
+ */
487
+ public DeletePrivilegesResponse deletePrivileges (DeletePrivilegesRequest request , RequestOptions options ) throws IOException {
488
+ return restHighLevelClient .performRequestAndParseEntity (request , SecurityRequestConverters ::deletePrivileges , options ,
489
+ DeletePrivilegesResponse ::fromXContent , singleton (404 ));
490
+ }
491
+
492
+ /**
493
+ * Asynchronously removes an application privilege
494
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-privilege.html">
495
+ * the docs</a> for more.
496
+ * @param request the request with the application privilege to delete
497
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
498
+ * @param listener the listener to be notified upon request completion
499
+ */
500
+ public void deletePrivilegesAsync (DeletePrivilegesRequest request , RequestOptions options ,
501
+ ActionListener <DeletePrivilegesResponse > listener ) {
502
+ restHighLevelClient .performRequestAsyncAndParseEntity (request , SecurityRequestConverters ::deletePrivileges , options ,
503
+ DeletePrivilegesResponse ::fromXContent , listener , singleton (404 ));
504
+ }
505
+
476
506
}
0 commit comments