revokePrivilegeV2()
This operation revokes privileges or privilege groups from a specific role.
public Void revokePrivilegeV2(RevokePrivilegeReqV2 request)
Request Syntax
revokePrivilegeV2(RevokePrivilegeReqV2.builder()
.roleName(String roleName)
.privilege(String privilege)
.dbName(String dbName)
.collectionName(String collectionName)
.build()
)
BUILDER METHODS:
roleName(String roleName)
The name of the target role.
privilege(String privilege)
The privilege or privilege group to be revoked from the specified role. For details on possible privileges, refer to Grant Privileges or Privilege Group to Roles.
dbName(String dbName)
The target resource database. After this operation, the specified role loses access to the specified privileges within the specified database.
collectionName(String collectionName)
The target resource collection in the specified database. After this operation, the specified role loses access to the specified privileges within the specified collection.
RETURNS:
void
EXCEPTIONS:
MilvusClientExceptions
This exception will be raised when any error occurs during this operation.
Example
import io.milvus.v2.client.ConnectConfig
import io.milvus.v2.client.MilvusClientV2
import io.milvus.v2.service.rbac.request.CreateRoleReq
// 1. Set up a client
ConnectConfig connectConfig = ConnectConfig.builder()
.uri("http://localhost:19530")
.token("root:Milvus")
.build();
MilvusClientV2 client = new MilvusClientV2(connectConfig);
// 2. revoke privilege or privilege group
// The following assumes that you have already
// created a privilege group named `read_only`
List<String> privilege = "read_only"
RevokePrivilegeReqV2 revokePrivilegeReqV2 = RevokePrivilegeReqV2.builder()
.roleName("my_role")
.privilege("read_only")
.dbName("my_db")
.collectionName("my_collection")
.build()
client.revokePrivilegeV2(revokePrivilegeReqV2);