< Docs
  • Java


A MilvusClient interface. This method gets all users associated with a role.

Note: Gets all users associated with the specified role.
R<SelectRoleResponse> selectRole(SelectRoleParam requestParam);


Use the SelectRoleParam.Builder to construct a SelectRoleParam object.

import io.milvus.param.SelectRoleParam;
SelectRoleParam.Builder builder = SelectRoleParam.newBuilder();

Methods of SelectRoleParam.Builder:

withRoleName(String roleName)Sets the role name.
The role name cannot be empty or null.
roleName: Name of the role to which certain privileges are bound.
withIncludeUserInfo(boolean includeUserInfo)Sets the includeUserInfo.
The default value of includeUserInfo is false.
includeUserInfo: Whether UserInfo is included in the returned results.

The can throw the following exceptions:

  • ParamException: error if the parameter is invalid.


This method catches all the exceptions and returns an R object.

  • If the API fails on the server side, it returns an error code and an error message.
  • If the API fails due to RPC exceptions, it returns R.Status.Unknown and error message of the exception.
  • If the API succeeds, it returns R.Status.Success.


import io.milvus.param.SelectRoleParam;

R<RpcStatus> response = client.selectRole(SelectRoleParam.newBuilder()

if (response.getStatus() != R.Status.Success.getCode()) {
    throw new RuntimeException(response.getMessage());