Skip to content

Commit b097280

Browse files
update docs
Signed-off-by: AnthonyTsu1984 <wenjia.tu@zilliz.com>
1 parent 4411af0 commit b097280

209 files changed

Lines changed: 12300 additions & 1672 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# alterRole()
2+
3+
This operation updates the description of an existing role.
4+
5+
```java
6+
public void alterRole(AlterRoleReq request)
7+
```
8+
9+
## Request Syntax
10+
11+
```java
12+
client.alterRole(AlterRoleReq.builder()
13+
.roleName(String roleName)
14+
.description(String description)
15+
.build()
16+
);
17+
```
18+
19+
**BUILDER METHODS:**
20+
21+
- `roleName(String roleName)`
22+
23+
**[REQUIRED]**
24+
25+
The name of the role to update.
26+
27+
- `description(String description)`
28+
29+
The new description of the role. Use an empty string to clear the description.
30+
31+
**RETURNS:**
32+
33+
*void*
34+
35+
This operation returns no value.
36+
37+
**EXCEPTIONS:**
38+
39+
- **MilvusClientException**
40+
41+
This exception will be raised when any error occurs during this operation.
42+
43+
## Example
44+
45+
```java
46+
import io.milvus.v2.service.rbac.request.AlterRoleReq;
47+
48+
client.alterRole(AlterRoleReq.builder()
49+
.roleName("analytics_reader")
50+
.description("Grants read-only access to analytics collections")
51+
.build());
52+
```
Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# createRole()
22

3-
This operation creates a custom role.
3+
This operation creates a role and optionally stores a description for that role.
44

55
```java
66
public void createRole(CreateRoleReq request)
@@ -9,47 +9,44 @@ public void createRole(CreateRoleReq request)
99
## Request Syntax
1010

1111
```java
12-
createRole(CreateRoleReq.builder()
12+
client.createRole(CreateRoleReq.builder()
1313
.roleName(String roleName)
14+
.description(String description)
1415
.build()
15-
)
16+
);
1617
```
1718

1819
**BUILDER METHODS:**
1920

2021
- `roleName(String roleName)`
2122

23+
**[REQUIRED]**
24+
2225
The name of the role to create.
2326

27+
- `description(String description)`
28+
29+
An optional description of the role. Defaults to an empty string.
30+
2431
**RETURNS:**
2532

2633
*void*
2734

35+
This operation returns no value.
36+
2837
**EXCEPTIONS:**
2938

30-
- **MilvusClientExceptions**
39+
- **MilvusClientException**
3140

3241
This exception will be raised when any error occurs during this operation.
3342

3443
## Example
3544

3645
```java
37-
import io.milvus.v2.client.ConnectConfig;
38-
import io.milvus.v2.client.MilvusClientV2;
3946
import io.milvus.v2.service.rbac.request.CreateRoleReq;
4047

41-
// 1. Set up a client
42-
ConnectConfig connectConfig = ConnectConfig.builder()
43-
.uri("http://localhost:19530")
44-
.token("root:Milvus")
45-
.build();
46-
47-
MilvusClientV2 client = new MilvusClientV2(connectConfig);
48-
49-
// 2. Create a role
50-
CreateRoleReq createRoleReq = CreateRoleReq.builder()
51-
.roleName("read_only")
52-
.build();
53-
54-
client.createRole(createRoleReq);
48+
client.createRole(CreateRoleReq.builder()
49+
.roleName("analytics_reader")
50+
.description("Grants read-only access to analytics collections")
51+
.build());
5552
```
Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# createUser()
22

3-
This operation creates a user.
3+
This operation creates a user and optionally stores a description for that user.
44

55
```java
66
public void createUser(CreateUserReq request)
@@ -9,54 +9,52 @@ public void createUser(CreateUserReq request)
99
## Request Syntax
1010

1111
```java
12-
createUser(CreateUserReq.builder()
12+
client.createUser(CreateUserReq.builder()
1313
.userName(String userName)
1414
.password(String password)
15+
.description(String description)
1516
.build()
16-
)
17+
);
1718
```
1819

1920
**BUILDER METHODS:**
2021

21-
- `userName(String roleName)`
22+
- `userName(String userName)`
23+
24+
**[REQUIRED]**
2225

2326
The name of the user to create.
2427

2528
- `password(String password)`
2629

27-
The password of the user to create.
30+
**[REQUIRED]**
31+
32+
The password for the user.
33+
34+
- `description(String description)`
35+
36+
An optional description of the user. Defaults to an empty string.
2837

2938
**RETURNS:**
3039

3140
*void*
3241

42+
This operation returns no value.
43+
3344
**EXCEPTIONS:**
3445

35-
- **MilvusClientExceptions**
46+
- **MilvusClientException**
3647

3748
This exception will be raised when any error occurs during this operation.
3849

3950
## Example
4051

4152
```java
42-
import io.milvus.v2.client.ConnectConfig;
43-
import io.milvus.v2.client.MilvusClientV2;
4453
import io.milvus.v2.service.rbac.request.CreateUserReq;
4554

46-
// 1. Set up a client
47-
ConnectConfig connectConfig = ConnectConfig.builder()
48-
.uri("http://localhost:19530")
49-
.token("root:Milvus")
50-
.build();
51-
52-
MilvusClientV2 client = new MilvusClientV2(connectConfig);
53-
54-
// 2. Create a user
55-
CreateUserReq createUserReq = CreateUserReq.builder()
56-
.userName("test")
57-
.password("Zilliz@2023")
58-
.build();
59-
60-
client.createUser(createUserReq);
55+
client.createUser(CreateUserReq.builder()
56+
.userName("analyst_user")
57+
.password("P@ssw0rd!")
58+
.description("Read-only analyst account")
59+
.build());
6160
```
62-
Lines changed: 15 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# describeRole()
22

3-
This operation describes a specific role.
3+
This operation returns the privileges granted to a role and the role description.
44

55
```java
66
public DescribeRoleResp describeRole(DescribeRoleReq request)
@@ -9,72 +9,40 @@ public DescribeRoleResp describeRole(DescribeRoleReq request)
99
## Request Syntax
1010

1111
```java
12-
describeRole(DescribeRoleReq.builder()
12+
DescribeRoleResp resp = client.describeRole(DescribeRoleReq.builder()
1313
.roleName(String roleName)
14-
.dbName(String dbName)
1514
.build()
16-
)
15+
);
1716
```
1817

1918
**BUILDER METHODS:**
2019

2120
- `roleName(String roleName)`
2221

23-
The name of the role to describe.
24-
25-
- `dbName(String dbName)`
26-
27-
The name of the database associated with the role.
22+
**[REQUIRED]**
2823

29-
**RETURN Type:**
30-
31-
*DescribeRoleResp.GrantInfo*
24+
The name of the role to describe.
3225

3326
**RETURNS:**
3427

35-
A **DescribeRoleResp.GrantInfo** object representing the permissions assigned to the role.
36-
37-
**PARAMETERS:**
28+
*DescribeRoleResp*
3829

39-
- **objectType** (*String*):
40-
The type of the object being granted a privilege.
41-
42-
- **privilege** (*String*):
43-
The specific privilege granted to the object.
44-
45-
- **objectName** (*String*):
46-
The name of the object to which the privilege is granted.
47-
48-
- **dbName** (*String*):
49-
The name of the database associated with the granted privilege.
50-
51-
- **grantor** (*String*):
52-
The name of the entity (user or role) that granted the privilege.
30+
The response contains `roleName`, `grantInfos`, and `description`.
5331

5432
**EXCEPTIONS:**
5533

56-
- **MilvusClientExceptions**
34+
- **MilvusClientException**
5735

5836
This exception will be raised when any error occurs during this operation.
5937

6038
## Example
6139

6240
```java
63-
import io.milvus.v2.client.ConnectConfig;
64-
import io.milvus.v2.client.MilvusClientV2;
65-
import io.milvus.v2.service.rbac.request.DescribeUserReq;
66-
67-
// 1. Set up a client
68-
ConnectConfig connectConfig = ConnectConfig.builder()
69-
.uri("http://localhost:19530")
70-
.token("root:Milvus")
71-
.build();
72-
73-
MilvusClientV2 client = new MilvusClientV2(connectConfig);
74-
75-
// 2. Describe a role
76-
DescribeRoleReq describeRoleReq = DescribeRoleReq.builder()
77-
.roleName("test")
78-
.build();
79-
client.describeRole(describeRoleReq);
41+
import io.milvus.v2.service.rbac.request.DescribeRoleReq;
42+
import io.milvus.v2.service.rbac.response.DescribeRoleResp;
43+
44+
DescribeRoleResp resp = client.describeRole(DescribeRoleReq.builder()
45+
.roleName("analytics_reader")
46+
.build());
47+
System.out.println(resp.getDescription());
8048
```
Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# describeUser()
22

3-
This operation describes a specific user.
3+
This operation returns the roles assigned to a user and the user description.
44

55
```java
66
public DescribeUserResp describeUser(DescribeUserReq request)
@@ -9,57 +9,40 @@ public DescribeUserResp describeUser(DescribeUserReq request)
99
## Request Syntax
1010

1111
```java
12-
describeUser(DescribeUserReq.builder()
12+
DescribeUserResp resp = client.describeUser(DescribeUserReq.builder()
1313
.userName(String userName)
1414
.build()
15-
)
15+
);
1616
```
1717

1818
**BUILDER METHODS:**
1919

2020
- `userName(String userName)`
2121

22-
The name of the user to describe.
23-
24-
**RETURN TYPE:**
22+
**[REQUIRED]**
2523

26-
*DescribeUserResp*
24+
The name of the user to describe.
2725

2826
**RETURNS:**
2927

30-
A **DescribeUserResp** object containing the details of the user.
31-
32-
**PARAMETERS:**
33-
34-
- **roles** (*List\<String\>*) -
28+
*DescribeUserResp*
3529

36-
A list of role names associated with the user.
30+
The response contains `userName`, `roles`, and `description`.
3731

3832
**EXCEPTIONS:**
3933

40-
- **MilvusClientExceptions**
34+
- **MilvusClientException**
4135

4236
This exception will be raised when any error occurs during this operation.
4337

4438
## Example
4539

4640
```java
47-
import io.milvus.v2.client.ConnectConfig;
48-
import io.milvus.v2.client.MilvusClientV2;
4941
import io.milvus.v2.service.rbac.request.DescribeUserReq;
42+
import io.milvus.v2.service.rbac.response.DescribeUserResp;
5043

51-
// 1. Set up a client
52-
ConnectConfig connectConfig = ConnectConfig.builder()
53-
.uri("http://localhost:19530")
54-
.token("root:Milvus")
55-
.build();
56-
57-
MilvusClientV2 client = new MilvusClientV2(connectConfig);
58-
59-
// 2. Describe a user
60-
DescribeUserReq describeUserReq = DescribeUserReq.builder()
61-
.userName("test")
62-
.build();
63-
DescribeUserResp describeUserResp = client.describeUser(describeUserReq);
44+
DescribeUserResp resp = client.describeUser(DescribeUserReq.builder()
45+
.userName("analyst_user")
46+
.build());
47+
System.out.println(resp.getDescription());
6448
```
65-

0 commit comments

Comments
 (0)