createUser()
This operation creates a user.
public void createUser(CreateUserReq request)
Request Syntax
createUser(CreateUserReq.builder()
.userName(String userName)
.password(String password)
.build()
)
BUILDER METHODS:
-
userName(String roleName)
The name of the user to create.
-
password(String password)
The password of the user to create.
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.CreateUserReq
// 1. Set up a client
ConnectConfig connectConfig = ConnectConfig.builder()
.uri("https://inxx-xxxxxxxxxxxx.api.gcp-us-west1.zillizcloud.com:19530")
.token("user:password")
.build();
MilvusClientV2 client = new MilvusClientV2(connectConfig);
// 2. Create a role
CreateUserReq createUserReq = CreateUserReq.builder()
.userName("user_1")
.password("P@ssw0rd")
.build();
client.createUser(createUserReq);