< Docs
  • Java


MilvusClient interface. This method lists grant info for a role.

R<SelectGrantResponse> selectGrantForRoleAndObject(SelectGrantForRoleAndObjectParam requestParam);


Use the SelectGrantForRoleAndObjectParam.Builder to construct a SelectGrantForRoleAndObjectParam object.

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

Methods of SelectGrantForRoleAndObjectParam.Builder:

Method Description Parameters
withRoleName(String roleName) Sets the roleName. RoleName cannot be empty or null. roleName: The role name.
withObject(String object) Sets the object. object cannot be empty or null. object: A granted object in Milvus, such as collection, partition, and database.
withObjectName(String objectName) Sets the objectName. objectName cannot be empty or null. objectName: The object name.
build() Construct a SelectGrantForRoleAndObjectParam 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<SelectGrantResponse> 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.Unknown and error message of the exception.

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


import io.milvus.param.SelectGrantForRoleParam;

R<SelectGrantResponse> response = client.selectGrantForRoleAndObject(SelectGrantForRoleAndObjectParam.newBuilder()

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