delete-role-mapping.asciidoc 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. [role="xpack"]
  2. [[java-rest-high-security-delete-role-mapping]]
  3. === Delete Role Mapping API
  4. [[java-rest-high-security-delete-role-mapping-execution]]
  5. ==== Execution
  6. Deletion of a role mapping can be performed using the `security().deleteRoleMapping()`
  7. method:
  8. ["source","java",subs="attributes,callouts,macros"]
  9. --------------------------------------------------
  10. include-tagged::{doc-tests}/SecurityDocumentationIT.java[delete-role-mapping-execute]
  11. --------------------------------------------------
  12. [[java-rest-high-security-delete-role-mapping-response]]
  13. ==== Response
  14. The returned `DeleteRoleMappingResponse` contains a single field, `found`. If the mapping
  15. is successfully found and deleted, found is set to true. Otherwise, found is set to false.
  16. ["source","java",subs="attributes,callouts,macros"]
  17. --------------------------------------------------
  18. include-tagged::{doc-tests}/SecurityDocumentationIT.java[delete-role-mapping-response]
  19. --------------------------------------------------
  20. <1> `found` is a boolean indicating whether the role mapping was found and deleted
  21. [[java-rest-high-security-delete-role-mapping-async]]
  22. ==== Asynchronous Execution
  23. This request can be executed asynchronously using the `security().deleteRoleMappingAsync()`
  24. method:
  25. ["source","java",subs="attributes,callouts,macros"]
  26. --------------------------------------------------
  27. include-tagged::{doc-tests}/SecurityDocumentationIT.java[delete-role-mapping-execute-async]
  28. --------------------------------------------------
  29. <1> The `DeleteRoleMappingRequest` to execute and the `ActionListener` to use when
  30. the execution completes
  31. The asynchronous method does not block and returns immediately. Once the request
  32. has completed the `ActionListener` is called back using the `onResponse` method
  33. if the execution successfully completed or using the `onFailure` method if
  34. it failed.
  35. A typical listener for a `DeleteRoleMappingResponse` looks like:
  36. ["source","java",subs="attributes,callouts,macros"]
  37. --------------------------------------------------
  38. include-tagged::{doc-tests}/SecurityDocumentationIT.java[delete-role-mapping-execute-listener]
  39. --------------------------------------------------
  40. <1> Called when the execution is successfully completed. The response is
  41. provided as an argument
  42. <2> Called in case of failure. The raised exception is provided as an argument