milvus-logo
LFAI
< Docs
  • Java

selectRole()

MilvusClient interface. This method gets all users’ information about a role.

R<SelectRoleResponse> selectRole(SelectRoleParam requestParam);

SelectRoleParam

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 SelectRoleParam.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<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.

Example

import io.milvus.param.SelectRoleParam;

R<SelectRoleResponse> response = client.selectRole(SelectRoleParam.newBuilder()
            .withRoleName(roleName)
            .build());

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

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?