OpenSearch/docs/java-rest/high-level/security/delete-role-mapping.asciidoc

52 lines
2.3 KiB
Plaintext
Raw Normal View History

[[java-rest-high-security-delete-role-mapping]]
=== Delete Role Mapping API
[[java-rest-high-security-delete-role-mapping-execution]]
==== Execution
Deletion of a role mapping can be performed using the `security().deleteRoleMapping()`
method:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/SecurityDocumentationIT.java[delete-role-mapping-execute]
--------------------------------------------------
[[java-rest-high-security-delete-role-mapping-response]]
==== Response
The returned `DeleteRoleMappingResponse` contains a single field, `found`. If the mapping
is successfully found and deleted, found is set to true. Otherwise, found is set to false.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/SecurityDocumentationIT.java[delete-role-mapping-response]
--------------------------------------------------
<1> `found` is a boolean indicating whether the role mapping was found and deleted
[[java-rest-high-security-delete-role-mapping-async]]
==== Asynchronous Execution
This request can be executed asynchronously using the `security().deleteRoleMappingAsync()`
method:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/SecurityDocumentationIT.java[delete-role-mapping-execute-async]
--------------------------------------------------
<1> The `DeleteRoleMappingRequest` to execute and the `ActionListener` to use when
the execution completes
The asynchronous method does not block and returns immediately. Once the request
has completed the `ActionListener` is called back using the `onResponse` method
if the execution successfully completed or using the `onFailure` method if
it failed.
A typical listener for a `DeleteRoleMappingResponse` looks like:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/SecurityDocumentationIT.java[delete-role-mapping-execute-listener]
--------------------------------------------------
<1> Called when the execution is successfully completed. The response is
provided as an argument
<2> Called in case of failure. The raised exception is provided as an argument