milvus-logo
LFAI
< Docs
  • Java

selectGrantForRole()

MilvusClient interface. This method lists grant info for the role and the specific object.

R<SelectGrantResponse> selectGrantForRole(SelectGrantForRoleParam requestParam);

SelectGrantForRoleParam

Use the SelectGrantForRoleParam.Builder to construct a SelectGrantForRoleParam object.

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

Methods of SelectGrantForRoleParam.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.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

build()

Construct a SelectGrantForRoleParam object.

N/A

The SelectGrantForRoleParam.Builder.build() can throw the following exceptions:

  • ParamException: error if the parameter is invalid.

Returns

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.

Example

import io.milvus.param.SelectGrantForRoleParam;

R<RpcStatus> response = client.selectGrantForRole(SelectGrantForRoleParam.newBuilder()
        .withRoleName(roleName)
        .build());

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

Was this page helpful?