Get Role Mappings APIedit
Executionedit
Retrieving 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);
Responseedit
The returned GetRoleMappingsResponse
contains the list of role mapping(s).
List<ExpressionRoleMapping> mappings = response.getMappings();
Asynchronous Executionedit
This 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: