NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Get Role Mappings API
editGet Role Mappings API
editExecution
editRetrieving a role mapping can be performed using the security().getRoleMappings()
method and by setting role mapping name on GetRoleMappingsRequest
:
final GetRoleMappingsRequest request = new GetRoleMappingsRequest("mapping-example-1"); final GetRoleMappingsResponse response = client.security().getRoleMappings(request, RequestOptions.DEFAULT);
Retrieving multiple role mappings can be performed using the security.getRoleMappings()
method and by setting role mapping names on GetRoleMappingsRequest
:
final GetRoleMappingsRequest request = new GetRoleMappingsRequest("mapping-example-1", "mapping-example-2"); final GetRoleMappingsResponse response = client.security().getRoleMappings(request, RequestOptions.DEFAULT);
Retrieving all role mappings can be performed using the security.getRoleMappings()
method and with no role mapping name on GetRoleMappingsRequest
:
final GetRoleMappingsRequest request = new GetRoleMappingsRequest(); final GetRoleMappingsResponse response = client.security().getRoleMappings(request, RequestOptions.DEFAULT);
Response
editThe returned GetRoleMappingsResponse
contains the list of role mapping(s).
List<ExpressionRoleMapping> mappings = response.getMappings();
Asynchronous Execution
editThis request can be executed asynchronously using the security().getRoleMappingsAsync()
method:
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 GetRoleMappingsResponse
looks like: