@zilliz/milvus2-sdk-node 2.2.1 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,23 @@
1
1
  import { Client } from './Client';
2
- import { ListCredUsersResponse, ResStatus } from './types/Response';
3
- import { CreateUserReq, DeleteUserReq, ListUsersReq, UpdateUserReq } from './types/User';
4
- /**
5
- * See all [collection operation examples](https://github.com/milvus-io/milvus-sdk-node/blob/main/example/Collection.ts).
6
- */
2
+ import { ListCredUsersResponse, ResStatus, SelectRoleResponse, SelectUserResponse, SelectGrantResponse, HasRoleResponse } from './types/Response';
3
+ import { CreateUserReq, DeleteUserReq, ListUsersReq, UpdateUserReq, CreateRoleReq, DropRoleReq, AddUserToRoleReq, RemoveUserFromRoleReq, SelectRoleReq, SelectUserReq, OperateRolePrivilegeReq, SelectGrantReq, ListGrantsReq, HasRoleReq } from './types/User';
4
+ import { GrpcTimeOut } from './types/Common';
7
5
  export declare class User extends Client {
8
6
  /**
9
7
  * Create user in milvus
10
8
  *
11
9
  * @param data
12
- * | Property | Type | Description |
13
- * | :-------------- | :---- | :------------------------------- |
14
- * | username | String | username |
15
- * | password | String | user password |
10
+ * | Property | Type | Description |
11
+ * | :-------------- | :---- | :---- |
12
+ * | username | String | username |
13
+ * | password | String | user password |
16
14
  *
17
15
  *
18
16
  * @return
19
- * | Property | Description |
17
+ * | Property | Description |
20
18
  * | :-------------| :-------- |
21
- * | error_code | Error code number |
22
- * | reason | Error cause|
19
+ * | error_code | Error code number |
20
+ * | reason | Error cause|
23
21
  *
24
22
  * #### Example
25
23
  *
@@ -35,17 +33,17 @@ export declare class User extends Client {
35
33
  * Update user in milvus
36
34
  *
37
35
  * @param data
38
- * | Property | Type | Description |
39
- * | :-------------- | :---- | :------------------------------- |
40
- * | username | String | username |
41
- * | password | String | user password |
36
+ * | Property | Type | Description |
37
+ * | :-------------- | :---- | :------ |
38
+ * | username | String | username |
39
+ * | password | String | user password |
42
40
  *
43
41
  *
44
42
  * @return
45
- * | Property | Description |
43
+ * | Property | Description |
46
44
  * | :-------------| :-------- |
47
- * | error_code | Error code number |
48
- * | reason | Error cause|
45
+ * | error_code | Error code number |
46
+ * | reason | Error cause|
49
47
  *
50
48
  * #### Example
51
49
  *
@@ -61,16 +59,16 @@ export declare class User extends Client {
61
59
  * Delete user in milvus
62
60
  *
63
61
  * @param data
64
- * | Property | Type | Description |
65
- * | :-------------- | :---- | :------------------------------- |
66
- * | username | String | username |
62
+ * | Property | Type | Description |
63
+ * | :-------------- | :---- | :-- |
64
+ * | username | String | username |
67
65
  *
68
66
  *
69
67
  * @return
70
- * | Property | Description |
68
+ * | Property | Description |
71
69
  * | :-------------| :-------- |
72
- * | error_code | Error code number |
73
- * | reason | Error cause|
70
+ * | error_code | Error code number |
71
+ * | reason | Error cause|
74
72
  *
75
73
  * #### Example
76
74
  *
@@ -85,10 +83,10 @@ export declare class User extends Client {
85
83
  * List user in milvus
86
84
  *
87
85
  * @return
88
- * | Property | Description |
86
+ * | Property | Description |
89
87
  * | :-------------| :-------- |
90
- * | status | { error_code: number, reason: string }|
91
- * | usernames | string[] |
88
+ * | status | { error_code: number, reason: string }|
89
+ * | usernames | string[] |
92
90
  *
93
91
  * #### Example
94
92
  *
@@ -97,4 +95,294 @@ export declare class User extends Client {
97
95
  * ```
98
96
  */
99
97
  listUsers(data?: ListUsersReq): Promise<ListCredUsersResponse>;
98
+ /**
99
+ * Create user role
100
+ *
101
+ * @return
102
+ * | Property | Description |
103
+ * | :-------------| :-------- |
104
+ * | status | { error_code: number, reason: string }|
105
+ * | reason | '' |
106
+ *
107
+ * #### Example
108
+ *
109
+ * ```
110
+ * milvusClient.userManager.createRole({roleName: 'myrole'});
111
+ * ```
112
+ */
113
+ createRole(data: CreateRoleReq): Promise<ResStatus>;
114
+ /**
115
+ * Drop user role
116
+ *
117
+ * @return
118
+ * | Property | Description |
119
+ * | :-------------| :-------- |
120
+ * | status | { error_code: number, reason: string }|
121
+ * | reason | '' |
122
+ *
123
+ * #### Example
124
+ *
125
+ * ```
126
+ * milvusClient.userManager.dropRole({roleName: 'myrole'});
127
+ * ```
128
+ */
129
+ dropRole(data: DropRoleReq): Promise<ResStatus>;
130
+ /**
131
+ * add user to role
132
+ *
133
+ * @return
134
+ * | Property | Description |
135
+ * | :-------------| :-------- |
136
+ * | status | { error_code: number, reason: string }|
137
+ * | reason | '' |
138
+ *
139
+ * #### Example
140
+ *
141
+ * ```
142
+ * milvusClient.userManager.addUserToRole({username: 'my', roleName: 'myrole'});
143
+ * ```
144
+ */
145
+ addUserToRole(data: AddUserToRoleReq): Promise<ResStatus>;
146
+ /**
147
+ * remove user from role
148
+ *
149
+ * @return
150
+ * | Property | Description |
151
+ * | :-------------| :-------- |
152
+ * | status | { error_code: number, reason: string }|
153
+ * | reason | '' |
154
+ *
155
+ * #### Example
156
+ *
157
+ * ```
158
+ * milvusClient.userManager.removeUserFromRole({username: 'my', roleName: 'myrole'});
159
+ * ```
160
+ */
161
+ removeUserFromRole(data: RemoveUserFromRoleReq): Promise<ResStatus>;
162
+ /**
163
+ * gets all users that belong to a specified role
164
+ *
165
+ * @param data
166
+ * | Property | Type | Description |
167
+ * | :------- | :----- | :------------ |
168
+ * | roleName | String | role name |
169
+ * | includeUserInfo? | boolean | should result including user info, by default: true |
170
+ * | timeout | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
171
+
172
+ * @return
173
+ * | Property | Description |
174
+ * | :-------------| :-------- |
175
+ * | status | { error_code: number, reason: string }|
176
+ * | results | { users: {name: string}[]; role: {name: string} }[] |
177
+ *
178
+ * #### Example
179
+ *
180
+ * ```
181
+ * milvusClient.userManager.selectRole({roleName: 'myrole'});
182
+ * ```
183
+ */
184
+ selectRole(data: SelectRoleReq): Promise<SelectRoleResponse>;
185
+ /**
186
+ * list all roles
187
+ *
188
+ * @param data
189
+ * | Property | Type | Description |
190
+ * | :------- | :----- | :------------ |
191
+ * | timeout | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
192
+ *
193
+ * @return
194
+ * | Property | Description |
195
+ * | :-------------| :-------- |
196
+ * | status | { error_code: number, reason: string }|
197
+ * | reason | '' |
198
+ *
199
+ * #### Example
200
+ *
201
+ * ```
202
+ * milvusClient.userManager.listRoles();
203
+ * ```
204
+ */
205
+ listRoles(data?: GrpcTimeOut): Promise<SelectRoleResponse>;
206
+ /**
207
+ * gets all users that belong to a specified role
208
+ *
209
+ * @param data
210
+ * | Property | Type | Description |
211
+ * | :------- | :----- | :------------ |
212
+ * | userName | String | user name |
213
+ * | includeUserInfo? | boolean | should result including user info, by default: true |
214
+ * | timeout | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
215
+ *
216
+ * @return
217
+ * | Property | Description |
218
+ * | :-------------| :-------- |
219
+ * | status | { error_code: number, reason: string }|
220
+ * | results | user: {name: string}; roles: {name: string}[] |
221
+ *
222
+ * #### Example
223
+ *
224
+ * ```
225
+ * milvusClient.userManager.selectUser({username: 'name'});
226
+ * ```
227
+ */
228
+ selectUser(data: SelectUserReq): Promise<SelectUserResponse>;
229
+ /**
230
+ * grant privileges to a role
231
+ *
232
+ * @param data
233
+ * | Property | Type | Description |
234
+ * | :------- | :----- | :------------ |
235
+ * | roleName | String | role name |
236
+ * | object | string | Type of the operational object to which the specified privilege belongs, such as Collection, Index, Partition, etc. This parameter is case-sensitive.|
237
+ * | objectName | string | Name of the object to which the role is granted the specified prvilege. |
238
+ * | privilegeName | string | Name of the privilege to be granted to the role. This parameter is case-sensitive. |
239
+ * | timeout | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
240
+ *
241
+ * @return
242
+ * | Property | Description |
243
+ * | :-------------| :-------- |
244
+ * | status | { error_code: number, reason: string }|
245
+ * | reason | '' |
246
+ *
247
+ * #### Example
248
+ *
249
+ * ```
250
+ * milvusClient.userManager.grantRolePrivilege({
251
+ * roleName: 'roleName',
252
+ * object: '*',
253
+ * objectName: 'Collection',
254
+ * privilegeName: 'CreateIndex'
255
+ * });
256
+ * ```
257
+ */
258
+ grantRolePrivilege(data: OperateRolePrivilegeReq): Promise<ResStatus>;
259
+ /**
260
+ * revoke privileges to a role
261
+ *
262
+ * @param data
263
+ * | Property | Type | Description |
264
+ * | :------- | :----- | :------------ |
265
+ * | roleName | String | role name |
266
+ * | object | string | Type of the operational object to which the specified privilege belongs, such as Collection, Index, Partition, etc. This parameter is case-sensitive.|
267
+ * | objectName | string | Name of the object to which the role is granted the specified prvilege. |
268
+ * | privilegeName | string | Name of the privilege to be granted to the role. This parameter is case-sensitive. |
269
+ * | timeout | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
270
+ *
271
+ * @return
272
+ * | Property | Description |
273
+ * | :------------- | :-------- |
274
+ * | status | { error_code: number, reason: string }|
275
+ * | reason | '' |
276
+ *
277
+ * #### Example
278
+ *
279
+ * ```
280
+ * milvusClient.userManager.grantRolePrivilege({
281
+ * roleName: 'roleName',
282
+ * object: '*',
283
+ * objectName: 'Collection',
284
+ * privilegeName: 'CreateIndex'
285
+ * });
286
+ * ```
287
+ */
288
+ revokeRolePrivilege(data: OperateRolePrivilegeReq): Promise<ResStatus>;
289
+ /**
290
+ * revoke all roles priviledges
291
+ * @param data
292
+ * | Property | Type | Description |
293
+ * | :------- | :----- | :------------ |
294
+ * | roleName | String | role name |
295
+ * | object | string | Type of the operational object to which the specified privilege belongs, such as Collection, Index, Partition, etc. This parameter is case-sensitive.|
296
+ * | objectName | string | Name of the object to which the role is granted the specified prvilege. |
297
+ * | privilegeName | string | Name of the privilege to be granted to the role. This parameter is case-sensitive. |
298
+ * | timeout | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
299
+ *
300
+ * @return
301
+ * | Property | Description |
302
+ * | :-------------| :-------- |
303
+ * | status | { error_code: number, reason: string }|
304
+ * | reason | '' |
305
+ *
306
+ * #### Example
307
+ *
308
+ * ```
309
+ * milvusClient.userManager.revokeAllRolesPrivileges({});
310
+ * ```
311
+ */
312
+ revokeAllRolesPrivileges(data?: GrpcTimeOut): Promise<ResStatus[]>;
313
+ /**
314
+ * select a grant
315
+ * @param data
316
+ * | Property | Type | Description |
317
+ * | :------- | :----- | :------------ |
318
+ * | roleName | String | role name |
319
+ * | object | string | Type of the operational object to which the specified privilege belongs, such as Collection, Index, Partition, etc. This parameter is case-sensitive.|
320
+ * | objectName | string | Name of the object to which the role is granted the specified prvilege. |
321
+ * | privilegeName | string | Name of the privilege to be granted to the role. This parameter is case-sensitive. |
322
+ * | timeout | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
323
+ *
324
+ * @return
325
+ * | Property | Description |
326
+ * | :-------------| :-------- |
327
+ * | status | { error_code: number, reason: string }|
328
+ * | reason | '' |
329
+ *
330
+ * #### Example
331
+ *
332
+ * ```
333
+ * milvusClient.userManager.selectGrant({
334
+ * roleName: 'roleName',
335
+ * object: '*',
336
+ * objectName: 'Collection',
337
+ * privilegeName: 'CreateIndex'
338
+ * });
339
+ * ```
340
+ */
341
+ selectGrant(data: SelectGrantReq): Promise<SelectGrantResponse>;
342
+ /**
343
+ * list all grants for a role
344
+ * @param data
345
+ * | Property | Type | Description |
346
+ * | :------- | :----- | :------------ |
347
+ * | roleName | String | role name |
348
+ * | timeout | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
349
+ *
350
+ * @return
351
+ * | Property | Description |
352
+ * | :-------------| :-------- |
353
+ * | status | { error_code: number, reason: string }|
354
+ * | reason | '' |
355
+ *
356
+ * #### Example
357
+ *
358
+ * ```
359
+ * milvusClient.userManager.listGrants({
360
+ * roleName: 'roleName',
361
+ * });
362
+ * ```
363
+ */
364
+ listGrants(data: ListGrantsReq): Promise<SelectGrantResponse>;
365
+ /**
366
+ * check if the role is existing
367
+ * @param data
368
+ * | Property | Type | Description |
369
+ * | :------- | :----- | :------------ |
370
+ * | roleName | String | role name |
371
+ * | timeout | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
372
+ *
373
+ * @return
374
+ * | Property | Description |
375
+ * | :-------------| :-------- |
376
+ * | status | { error_code: number, reason: string }|
377
+ * | reason | '' |
378
+ *
379
+ * #### Example
380
+ *
381
+ * ```
382
+ * milvusClient.userManager.hasRole({
383
+ * roleName: 'roleName',
384
+ * });
385
+ * ```
386
+ */
387
+ hasRole(data: HasRoleReq): Promise<HasRoleResponse>;
100
388
  }