3838import org .elasticsearch .client .security .DeleteUserRequest ;
3939import org .elasticsearch .client .security .DeleteUserResponse ;
4040import org .elasticsearch .client .security .DisableUserRequest ;
41- import org .elasticsearch .client .security .EmptyResponse ;
4241import org .elasticsearch .client .security .EnableUserRequest ;
4342import org .elasticsearch .client .security .GetPrivilegesRequest ;
4443import org .elasticsearch .client .security .GetPrivilegesResponse ;
@@ -235,14 +234,12 @@ public void getRoleMappingsAsync(final GetRoleMappingsRequest request, final Req
235234 *
236235 * @param request the request with the user to enable
237236 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
238- * @return the response from the enable user call
237+ * @return {@code true} if the request succeeded (the user is enabled)
239238 * @throws IOException in case there is a problem sending the request or parsing back the response
240- * @deprecated use {@link #enableUser(RequestOptions, EnableUserRequest)} instead
241239 */
242- @ Deprecated
243- public EmptyResponse enableUser (EnableUserRequest request , RequestOptions options ) throws IOException {
244- return restHighLevelClient .performRequestAndParseEntity (request , SecurityRequestConverters ::enableUser , options ,
245- EmptyResponse ::fromXContent , emptySet ());
240+ public boolean enableUser (EnableUserRequest request , RequestOptions options ) throws IOException {
241+ return restHighLevelClient .performRequest (request , SecurityRequestConverters ::enableUser , options ,
242+ RestHighLevelClient ::convertExistsResponse , emptySet ());
246243 }
247244
248245 /**
@@ -254,10 +251,11 @@ public EmptyResponse enableUser(EnableUserRequest request, RequestOptions option
254251 * @param request the request with the user to enable
255252 * @return {@code true} if the request succeeded (the user is enabled)
256253 * @throws IOException in case there is a problem sending the request or parsing back the response
254+ * @deprecated use {@link #enableUser(EnableUserRequest, RequestOptions)} instead
257255 */
256+ @ Deprecated
258257 public boolean enableUser (RequestOptions options , EnableUserRequest request ) throws IOException {
259- return restHighLevelClient .performRequest (request , SecurityRequestConverters ::enableUser , options ,
260- RestHighLevelClient ::convertExistsResponse , emptySet ());
258+ return enableUser (request , options );
261259 }
262260
263261 /**
@@ -268,13 +266,11 @@ public boolean enableUser(RequestOptions options, EnableUserRequest request) thr
268266 * @param request the request with the user to enable
269267 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
270268 * @param listener the listener to be notified upon request completion
271- * @deprecated use {@link #enableUserAsync(RequestOptions, EnableUserRequest, ActionListener)} instead
272269 */
273- @ Deprecated
274270 public void enableUserAsync (EnableUserRequest request , RequestOptions options ,
275- ActionListener <EmptyResponse > listener ) {
276- restHighLevelClient .performRequestAsyncAndParseEntity (request , SecurityRequestConverters ::enableUser , options ,
277- EmptyResponse :: fromXContent , listener , emptySet ());
271+ ActionListener <Boolean > listener ) {
272+ restHighLevelClient .performRequestAsync (request , SecurityRequestConverters ::enableUser , options ,
273+ RestHighLevelClient :: convertExistsResponse , listener , emptySet ());
278274 }
279275
280276 /**
@@ -285,11 +281,12 @@ public void enableUserAsync(EnableUserRequest request, RequestOptions options,
285281 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
286282 * @param request the request with the user to enable
287283 * @param listener the listener to be notified upon request completion
284+ * @deprecated use {@link #enableUserAsync(EnableUserRequest, RequestOptions, ActionListener)} instead
288285 */
286+ @ Deprecated
289287 public void enableUserAsync (RequestOptions options , EnableUserRequest request ,
290288 ActionListener <Boolean > listener ) {
291- restHighLevelClient .performRequestAsync (request , SecurityRequestConverters ::enableUser , options ,
292- RestHighLevelClient ::convertExistsResponse , listener , emptySet ());
289+ enableUserAsync (request , options , listener );
293290 }
294291
295292 /**
@@ -299,14 +296,12 @@ public void enableUserAsync(RequestOptions options, EnableUserRequest request,
299296 *
300297 * @param request the request with the user to disable
301298 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
302- * @return the response from the enable user call
299+ * @return {@code true} if the request succeeded (the user is disabled)
303300 * @throws IOException in case there is a problem sending the request or parsing back the response
304- * @deprecated use {@link #disableUser(RequestOptions, DisableUserRequest)} instead
305301 */
306- @ Deprecated
307- public EmptyResponse disableUser (DisableUserRequest request , RequestOptions options ) throws IOException {
308- return restHighLevelClient .performRequestAndParseEntity (request , SecurityRequestConverters ::disableUser , options ,
309- EmptyResponse ::fromXContent , emptySet ());
302+ public boolean disableUser (DisableUserRequest request , RequestOptions options ) throws IOException {
303+ return restHighLevelClient .performRequest (request , SecurityRequestConverters ::disableUser , options ,
304+ RestHighLevelClient ::convertExistsResponse , emptySet ());
310305 }
311306
312307 /**
@@ -318,10 +313,11 @@ public EmptyResponse disableUser(DisableUserRequest request, RequestOptions opti
318313 * @param request the request with the user to disable
319314 * @return {@code true} if the request succeeded (the user is disabled)
320315 * @throws IOException in case there is a problem sending the request or parsing back the response
316+ * @deprecated use {@link #disableUser(DisableUserRequest, RequestOptions)} instead
321317 */
318+ @ Deprecated
322319 public boolean disableUser (RequestOptions options , DisableUserRequest request ) throws IOException {
323- return restHighLevelClient .performRequest (request , SecurityRequestConverters ::disableUser , options ,
324- RestHighLevelClient ::convertExistsResponse , emptySet ());
320+ return disableUser (request , options );
325321 }
326322
327323 /**
@@ -332,13 +328,11 @@ public boolean disableUser(RequestOptions options, DisableUserRequest request) t
332328 * @param request the request with the user to disable
333329 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
334330 * @param listener the listener to be notified upon request completion
335- * @deprecated use {@link #disableUserAsync(RequestOptions, DisableUserRequest, ActionListener)} instead
336331 */
337- @ Deprecated
338332 public void disableUserAsync (DisableUserRequest request , RequestOptions options ,
339- ActionListener <EmptyResponse > listener ) {
340- restHighLevelClient .performRequestAsyncAndParseEntity (request , SecurityRequestConverters ::disableUser , options ,
341- EmptyResponse :: fromXContent , listener , emptySet ());
333+ ActionListener <Boolean > listener ) {
334+ restHighLevelClient .performRequestAsync (request , SecurityRequestConverters ::disableUser , options ,
335+ RestHighLevelClient :: convertExistsResponse , listener , emptySet ());
342336 }
343337
344338 /**
@@ -349,11 +343,12 @@ public void disableUserAsync(DisableUserRequest request, RequestOptions options,
349343 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
350344 * @param request the request with the user to disable
351345 * @param listener the listener to be notified upon request completion
346+ * @deprecated use {@link #disableUserAsync(DisableUserRequest, RequestOptions, ActionListener)} instead
352347 */
348+ @ Deprecated
353349 public void disableUserAsync (RequestOptions options , DisableUserRequest request ,
354350 ActionListener <Boolean > listener ) {
355- restHighLevelClient .performRequestAsync (request , SecurityRequestConverters ::disableUser , options ,
356- RestHighLevelClient ::convertExistsResponse , listener , emptySet ());
351+ disableUserAsync (request , options , listener );
357352 }
358353
359354 /**
@@ -523,14 +518,12 @@ public void getSslCertificatesAsync(RequestOptions options, ActionListener<GetSs
523518 *
524519 * @param request the request with the user's new password
525520 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
526- * @return the response from the change user password call
521+ * @return {@code true} if the request succeeded (the new password was set)
527522 * @throws IOException in case there is a problem sending the request or parsing back the response
528- * @deprecated use {@link #changePassword(RequestOptions, ChangePasswordRequest)} instead
529523 */
530- @ Deprecated
531- public EmptyResponse changePassword (ChangePasswordRequest request , RequestOptions options ) throws IOException {
532- return restHighLevelClient .performRequestAndParseEntity (request , SecurityRequestConverters ::changePassword , options ,
533- EmptyResponse ::fromXContent , emptySet ());
524+ public boolean changePassword (ChangePasswordRequest request , RequestOptions options ) throws IOException {
525+ return restHighLevelClient .performRequest (request , SecurityRequestConverters ::changePassword , options ,
526+ RestHighLevelClient ::convertExistsResponse , emptySet ());
534527 }
535528
536529 /**
@@ -542,10 +535,11 @@ public EmptyResponse changePassword(ChangePasswordRequest request, RequestOption
542535 * @param request the request with the user's new password
543536 * @return {@code true} if the request succeeded (the new password was set)
544537 * @throws IOException in case there is a problem sending the request or parsing back the response
538+ * @deprecated use {@link #changePassword(ChangePasswordRequest, RequestOptions)} instead
545539 */
540+ @ Deprecated
546541 public boolean changePassword (RequestOptions options , ChangePasswordRequest request ) throws IOException {
547- return restHighLevelClient .performRequest (request , SecurityRequestConverters ::changePassword , options ,
548- RestHighLevelClient ::convertExistsResponse , emptySet ());
542+ return changePassword (request , options );
549543 }
550544
551545 /**
@@ -556,13 +550,11 @@ public boolean changePassword(RequestOptions options, ChangePasswordRequest requ
556550 * @param request the request with the user's new password
557551 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
558552 * @param listener the listener to be notified upon request completion
559- * @deprecated use {@link #changePasswordAsync(RequestOptions, ChangePasswordRequest, ActionListener)} instead
560553 */
561- @ Deprecated
562554 public void changePasswordAsync (ChangePasswordRequest request , RequestOptions options ,
563- ActionListener <EmptyResponse > listener ) {
564- restHighLevelClient .performRequestAsyncAndParseEntity (request , SecurityRequestConverters ::changePassword , options ,
565- EmptyResponse :: fromXContent , listener , emptySet ());
555+ ActionListener <Boolean > listener ) {
556+ restHighLevelClient .performRequestAsync (request , SecurityRequestConverters ::changePassword , options ,
557+ RestHighLevelClient :: convertExistsResponse , listener , emptySet ());
566558 }
567559
568560 /**
@@ -573,14 +565,14 @@ public void changePasswordAsync(ChangePasswordRequest request, RequestOptions op
573565 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
574566 * @param request the request with the user's new password
575567 * @param listener the listener to be notified upon request completion
568+ * @deprecated use {@link #changePasswordAsync(ChangePasswordRequest, RequestOptions, ActionListener)} instead
576569 */
570+ @ Deprecated
577571 public void changePasswordAsync (RequestOptions options , ChangePasswordRequest request ,
578572 ActionListener <Boolean > listener ) {
579- restHighLevelClient .performRequestAsync (request , SecurityRequestConverters ::changePassword , options ,
580- RestHighLevelClient ::convertExistsResponse , listener , emptySet ());
573+ changePasswordAsync (request , options , listener );
581574 }
582575
583-
584576 /**
585577 * Delete a role mapping.
586578 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role-mapping.html">
0 commit comments