< Docs
  • Java


MilvusClient interface. This method gets all users' information about a 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:

Method Description Parameters
withRoleName(String roleName) Sets the roleName. RoleName cannot be empty or null. roleName: The role name used to create the privilege.
withIncludeUserInfo(boolean includeUserInfo) Sets the includeUserInfo. includeUserInfo default false. includeUserInfo: The include user info or not.
build() Construct a SelectRoleParam object. N/A

The can throw the following exceptions:

  • ParamException: error if the parameter is invalid.


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

  • If the API fails on the server side, it returns the error code and message from the server.

  • If the API fails by RPC exception, it returns R.Status.Unknow and error message of the exception.

  • If the API succeeds, it returns a valid SelectRoleResponse held by the R template. You can use SelectRoleResponse to get the role information.


import io.milvus.param.SelectRoleParam;

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

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