@zilliz/milvus2-sdk-node 2.3.5 → 2.4.0
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.
- package/README.md +154 -35
- package/dist/milvus/HttpClient.d.ts +165 -2
- package/dist/milvus/HttpClient.js +17 -3
- package/dist/milvus/HttpClient.js.map +1 -1
- package/dist/milvus/MilvusClient.d.ts +3 -3
- package/dist/milvus/MilvusClient.js +42 -8
- package/dist/milvus/MilvusClient.js.map +1 -1
- package/dist/milvus/const/client.d.ts +4 -3
- package/dist/milvus/const/client.js +4 -3
- package/dist/milvus/const/client.js.map +1 -1
- package/dist/milvus/const/defaults.d.ts +5 -4
- package/dist/milvus/const/defaults.js +14 -13
- package/dist/milvus/const/defaults.js.map +1 -1
- package/dist/milvus/const/error.js +1 -1
- package/dist/milvus/const/error.js.map +1 -1
- package/dist/milvus/const/milvus.d.ts +47 -8
- package/dist/milvus/const/milvus.js +42 -3
- package/dist/milvus/const/milvus.js.map +1 -1
- package/dist/milvus/grpc/BaseClient.d.ts +11 -9
- package/dist/milvus/grpc/BaseClient.js +59 -21
- package/dist/milvus/grpc/BaseClient.js.map +1 -1
- package/dist/milvus/grpc/Collection.d.ts +311 -366
- package/dist/milvus/grpc/Collection.js +355 -387
- package/dist/milvus/grpc/Collection.js.map +1 -1
- package/dist/milvus/grpc/Data.d.ts +244 -291
- package/dist/milvus/grpc/Data.js +402 -539
- package/dist/milvus/grpc/Data.js.map +1 -1
- package/dist/milvus/grpc/Database.d.ts +29 -41
- package/dist/milvus/grpc/Database.js +32 -44
- package/dist/milvus/grpc/Database.js.map +1 -1
- package/dist/milvus/grpc/GrpcClient.d.ts +34 -13
- package/dist/milvus/grpc/GrpcClient.js +80 -70
- package/dist/milvus/grpc/GrpcClient.js.map +1 -1
- package/dist/milvus/grpc/MilvusIndex.d.ts +127 -67
- package/dist/milvus/grpc/MilvusIndex.js +166 -70
- package/dist/milvus/grpc/MilvusIndex.js.map +1 -1
- package/dist/milvus/grpc/Partition.d.ts +78 -113
- package/dist/milvus/grpc/Partition.js +109 -119
- package/dist/milvus/grpc/Partition.js.map +1 -1
- package/dist/milvus/grpc/Resource.d.ts +63 -92
- package/dist/milvus/grpc/Resource.js +69 -98
- package/dist/milvus/grpc/Resource.js.map +1 -1
- package/dist/milvus/grpc/User.d.ts +263 -295
- package/dist/milvus/grpc/User.js +287 -310
- package/dist/milvus/grpc/User.js.map +1 -1
- package/dist/milvus/http/Alias.d.ts +37 -0
- package/dist/milvus/http/Alias.js +62 -0
- package/dist/milvus/http/Alias.js.map +1 -0
- package/dist/milvus/http/Collection.d.ts +15 -1
- package/dist/milvus/http/Collection.js +55 -9
- package/dist/milvus/http/Collection.js.map +1 -1
- package/dist/milvus/http/Import.d.ts +33 -0
- package/dist/milvus/http/Import.js +48 -0
- package/dist/milvus/http/Import.js.map +1 -0
- package/dist/milvus/http/MilvusIndex.d.ts +35 -0
- package/dist/milvus/http/MilvusIndex.js +55 -0
- package/dist/milvus/http/MilvusIndex.js.map +1 -0
- package/dist/milvus/http/Partition.d.ts +41 -0
- package/dist/milvus/http/Partition.js +76 -0
- package/dist/milvus/http/Partition.js.map +1 -0
- package/dist/milvus/http/Role.d.ts +39 -0
- package/dist/milvus/http/Role.js +69 -0
- package/dist/milvus/http/Role.js.map +1 -0
- package/dist/milvus/http/User.d.ts +41 -0
- package/dist/milvus/http/User.js +76 -0
- package/dist/milvus/http/User.js.map +1 -0
- package/dist/milvus/http/Vector.d.ts +5 -3
- package/dist/milvus/http/Vector.js +10 -7
- package/dist/milvus/http/Vector.js.map +1 -1
- package/dist/milvus/http/index.d.ts +6 -0
- package/dist/milvus/http/index.js +6 -0
- package/dist/milvus/http/index.js.map +1 -1
- package/dist/milvus/index.d.ts +0 -1
- package/dist/milvus/index.js +0 -1
- package/dist/milvus/index.js.map +1 -1
- package/dist/milvus/types/Client.d.ts +5 -0
- package/dist/milvus/types/Collection.d.ts +34 -9
- package/dist/milvus/types/Common.d.ts +1 -3
- package/dist/milvus/types/Data.d.ts +79 -23
- package/dist/milvus/types/Data.js +1 -0
- package/dist/milvus/types/Data.js.map +1 -1
- package/dist/milvus/types/HighLevel.d.ts +6 -3
- package/dist/milvus/types/Http.d.ts +191 -9
- package/dist/milvus/types/MilvusIndex.d.ts +17 -3
- package/dist/milvus/utils/Bytes.d.ts +84 -0
- package/dist/milvus/utils/Bytes.js +261 -0
- package/dist/milvus/utils/Bytes.js.map +1 -0
- package/dist/milvus/utils/Format.d.ts +126 -68
- package/dist/milvus/utils/Format.js +375 -94
- package/dist/milvus/utils/Format.js.map +1 -1
- package/dist/milvus/utils/Function.d.ts +4 -2
- package/dist/milvus/utils/Function.js +58 -25
- package/dist/milvus/utils/Function.js.map +1 -1
- package/dist/milvus/utils/Grpc.d.ts +3 -2
- package/dist/milvus/utils/Grpc.js +65 -98
- package/dist/milvus/utils/Grpc.js.map +1 -1
- package/dist/milvus/utils/Validate.d.ts +18 -3
- package/dist/milvus/utils/Validate.js +38 -12
- package/dist/milvus/utils/Validate.js.map +1 -1
- package/dist/milvus/utils/index.d.ts +1 -1
- package/dist/milvus/utils/index.js +1 -1
- package/dist/milvus/utils/index.js.map +1 -1
- package/dist/proto/proto/common.proto +26 -1
- package/dist/proto/proto/google/protobuf/descriptor.proto +90 -28
- package/dist/proto/proto/milvus.proto +168 -2
- package/dist/proto/proto/rg.proto +28 -0
- package/dist/proto/proto/schema.proto +34 -0
- package/dist/sdk.json +1 -1
- package/package.json +8 -5
- package/dist/milvus/OrmClient.d.ts +0 -19
- package/dist/milvus/OrmClient.js +0 -51
- package/dist/milvus/OrmClient.js.map +0 -1
- package/dist/milvus/orm/Collection.d.ts +0 -43
- package/dist/milvus/orm/Collection.js +0 -165
- package/dist/milvus/orm/Collection.js.map +0 -1
- package/dist/milvus/orm/index.d.ts +0 -1
- package/dist/milvus/orm/index.js +0 -18
- package/dist/milvus/orm/index.js.map +0 -1
- package/dist/milvus/utils/Blob.d.ts +0 -4
- package/dist/milvus/utils/Blob.js +0 -18
- package/dist/milvus/utils/Blob.js.map +0 -1
package/dist/milvus/grpc/User.js
CHANGED
|
@@ -13,28 +13,40 @@ exports.User = void 0;
|
|
|
13
13
|
const Resource_1 = require("./Resource");
|
|
14
14
|
const __1 = require("../");
|
|
15
15
|
class User extends Resource_1.Resource {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
// alias
|
|
19
|
+
this.updatePassword = this.updateUser;
|
|
20
|
+
this.dropUser = this.deleteUser;
|
|
21
|
+
// alias
|
|
22
|
+
this.grantRole = this.addUserToRole;
|
|
23
|
+
// alias
|
|
24
|
+
this.revokeRole = this.removeUserFromRole;
|
|
25
|
+
// alias
|
|
26
|
+
this.selectRole = this.describeRole;
|
|
27
|
+
// alias
|
|
28
|
+
this.selectUser = this.describeUser;
|
|
29
|
+
// alias
|
|
30
|
+
this.grantRolePrivilege = this.grantPrivilege;
|
|
31
|
+
this.revokeRolePrivilege = this.revokePrivilege;
|
|
32
|
+
}
|
|
16
33
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @param data
|
|
20
|
-
* | Property | Type | Description |
|
|
21
|
-
* | :-- | :-- | :-- |
|
|
22
|
-
* | username | String | username |
|
|
23
|
-
* | password | String | user password |
|
|
24
|
-
* | 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 |
|
|
34
|
+
* Creates a new user in Milvus.
|
|
25
35
|
*
|
|
26
|
-
* @
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* | reason | Error cause|
|
|
36
|
+
* @param {CreateUserReq} data - The user data.
|
|
37
|
+
* @param {string} data.username - The username of the new user.
|
|
38
|
+
* @param {string} data.password - The password for the new user.
|
|
39
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
31
40
|
*
|
|
32
|
-
*
|
|
41
|
+
* @returns {Promise<ResStatus>} The response status.
|
|
42
|
+
* @returns {number} ResStatus.error_code - The error code number.
|
|
43
|
+
* @returns {string} ResStatus.reason - The cause of the error, if any.
|
|
33
44
|
*
|
|
34
|
-
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```javascript
|
|
35
47
|
* milvusClient.createUser({
|
|
36
|
-
* username:
|
|
37
|
-
* password:
|
|
48
|
+
* username: 'exampleUser',
|
|
49
|
+
* password: 'examplePassword',
|
|
38
50
|
* });
|
|
39
51
|
* ```
|
|
40
52
|
*/
|
|
@@ -44,7 +56,7 @@ class User extends Resource_1.Resource {
|
|
|
44
56
|
throw new Error(__1.ERROR_REASONS.USERNAME_PWD_ARE_REQUIRED);
|
|
45
57
|
}
|
|
46
58
|
const encryptedPassword = (0, __1.stringToBase64)(data.password);
|
|
47
|
-
const promise = yield (0, __1.promisify)(this.
|
|
59
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'CreateCredential', {
|
|
48
60
|
username: data.username,
|
|
49
61
|
password: encryptedPassword,
|
|
50
62
|
}, data.timeout || this.timeout);
|
|
@@ -52,28 +64,24 @@ class User extends Resource_1.Resource {
|
|
|
52
64
|
});
|
|
53
65
|
}
|
|
54
66
|
/**
|
|
55
|
-
* Update user in
|
|
56
|
-
*
|
|
57
|
-
* @param data
|
|
58
|
-
* | Property | Type | Description |
|
|
59
|
-
* | :-- | :-- | :-- |
|
|
60
|
-
* | username | String | username |
|
|
61
|
-
* | password | String | user password |
|
|
62
|
-
* | 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 |
|
|
67
|
+
* Update user in Milvus.
|
|
63
68
|
*
|
|
64
|
-
* @
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
+
* @param {UpdateUserReq} data - The user data.
|
|
70
|
+
* @param {string} data.username - The username of the user to be updated.
|
|
71
|
+
* @param {string} data.newPassword - The new password for the user.
|
|
72
|
+
* @param {string} data.oldPassword - The old password of the user.
|
|
73
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
69
74
|
*
|
|
70
|
-
*
|
|
75
|
+
* @returns {Promise<ResStatus>} The response status.
|
|
76
|
+
* @returns {number} ResStatus.error_code - The error code number.
|
|
77
|
+
* @returns {string} ResStatus.reason - The cause of the error, if any.
|
|
71
78
|
*
|
|
72
|
-
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```javascript
|
|
73
81
|
* milvusClient.updateUser({
|
|
74
|
-
* username:
|
|
75
|
-
* newPassword:
|
|
76
|
-
* oldPassword:
|
|
82
|
+
* username: 'exampleUser',
|
|
83
|
+
* newPassword: 'newPassword',
|
|
84
|
+
* oldPassword: 'oldPassword',
|
|
77
85
|
* });
|
|
78
86
|
* ```
|
|
79
87
|
*/
|
|
@@ -86,7 +94,7 @@ class User extends Resource_1.Resource {
|
|
|
86
94
|
}
|
|
87
95
|
const encryptedOldPwd = (0, __1.stringToBase64)(data.oldPassword);
|
|
88
96
|
const encryptedNewPwd = (0, __1.stringToBase64)(data.newPassword);
|
|
89
|
-
const promise = yield (0, __1.promisify)(this.
|
|
97
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'UpdateCredential', {
|
|
90
98
|
username: data.username,
|
|
91
99
|
oldPassword: encryptedOldPwd,
|
|
92
100
|
newPassword: encryptedNewPwd,
|
|
@@ -95,26 +103,20 @@ class User extends Resource_1.Resource {
|
|
|
95
103
|
});
|
|
96
104
|
}
|
|
97
105
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* @param data
|
|
101
|
-
* | Property | Type | Description |
|
|
102
|
-
* | :-- | :-- | :-- |
|
|
103
|
-
* | username | String | username |
|
|
104
|
-
* | 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 |
|
|
106
|
+
* Lists all users in Milvus.
|
|
105
107
|
*
|
|
106
|
-
* @
|
|
107
|
-
*
|
|
108
|
-
* | :-- | :-- |
|
|
109
|
-
* | error_code | Error code number |
|
|
110
|
-
* | reason | Error cause|
|
|
108
|
+
* @param {Object} data - The data object.
|
|
109
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
111
110
|
*
|
|
112
|
-
*
|
|
111
|
+
* @returns {Promise<Object>} The response object.
|
|
112
|
+
* @returns {Object} response.status - The response status.
|
|
113
|
+
* @returns {number} response.status.error_code - The error code number.
|
|
114
|
+
* @returns {string} response.status.reason - The cause of the error, if any.
|
|
115
|
+
* @returns {string[]} response.usernames - An array of usernames.
|
|
113
116
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* });
|
|
117
|
+
* @example
|
|
118
|
+
* ```javascript
|
|
119
|
+
* milvusClient.listUsers();
|
|
118
120
|
* ```
|
|
119
121
|
*/
|
|
120
122
|
deleteUser(data) {
|
|
@@ -122,121 +124,110 @@ class User extends Resource_1.Resource {
|
|
|
122
124
|
if (!data.username) {
|
|
123
125
|
throw new Error(__1.ERROR_REASONS.USERNAME_IS_REQUIRED);
|
|
124
126
|
}
|
|
125
|
-
const promise = yield (0, __1.promisify)(this.
|
|
127
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'DeleteCredential', {
|
|
126
128
|
username: data.username,
|
|
127
129
|
}, data.timeout || this.timeout);
|
|
128
130
|
return promise;
|
|
129
131
|
});
|
|
130
132
|
}
|
|
131
133
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* @param data
|
|
135
|
-
* | Property | Type | Description |
|
|
136
|
-
* | :-- | :-- | :-- |
|
|
137
|
-
* | 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 |
|
|
134
|
+
* Lists all users in Milvus.
|
|
138
135
|
*
|
|
139
|
-
* @
|
|
140
|
-
*
|
|
141
|
-
* | :-- | :-- |
|
|
142
|
-
* | status | { error_code: number, reason: string } |
|
|
143
|
-
* | usernames | string[] |
|
|
136
|
+
* @param {ListUsersReq} data - The data object.
|
|
137
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
144
138
|
*
|
|
145
|
-
*
|
|
139
|
+
* @returns {Promise<ListCredUsersResponse>} The response object.
|
|
140
|
+
* @returns {ResStatus} response.status - The response status.
|
|
141
|
+
* @returns {number} response.status.error_code - The error code number.
|
|
142
|
+
* @returns {string} response.status.reason - The cause of the error, if any.
|
|
143
|
+
* @returns {string[]} response.usernames - An array of usernames.
|
|
146
144
|
*
|
|
147
|
-
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```javascript
|
|
148
147
|
* milvusClient.listUsers();
|
|
149
148
|
* ```
|
|
150
149
|
*/
|
|
151
150
|
listUsers(data) {
|
|
152
151
|
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
-
const promise = yield (0, __1.promisify)(this.
|
|
152
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'ListCredUsers', {}, (data === null || data === void 0 ? void 0 : data.timeout) || this.timeout);
|
|
154
153
|
return promise;
|
|
155
154
|
});
|
|
156
155
|
}
|
|
157
156
|
/**
|
|
158
|
-
* Create
|
|
159
|
-
*
|
|
160
|
-
* @param data
|
|
161
|
-
* | Property | Type | Description |
|
|
162
|
-
* | :-- | :-- | :-- |
|
|
163
|
-
* | roleName | String | role name |
|
|
164
|
-
* | 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 |
|
|
157
|
+
* Create a new role in Milvus.
|
|
165
158
|
*
|
|
166
|
-
* @
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
* | status | { error_code: number, reason: string } |
|
|
170
|
-
* | reason | '' |
|
|
159
|
+
* @param {CreateRoleReq} data - The role data.
|
|
160
|
+
* @param {string} data.roleName - The name of the new role.
|
|
161
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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
162
|
*
|
|
172
|
-
*
|
|
163
|
+
* @returns {Promise<ResStatus>} The response status.
|
|
164
|
+
* @returns {number} ResStatus.error_code - The error code number.
|
|
165
|
+
* @returns {string} ResStatus.reason - The cause of the error, if any.
|
|
173
166
|
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```javascript
|
|
169
|
+
* milvusClient.createRole({
|
|
170
|
+
* roleName: 'exampleRole',
|
|
171
|
+
* });
|
|
176
172
|
* ```
|
|
177
173
|
*/
|
|
178
174
|
createRole(data) {
|
|
179
175
|
return __awaiter(this, void 0, void 0, function* () {
|
|
180
|
-
const promise = yield (0, __1.promisify)(this.
|
|
176
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'CreateRole', {
|
|
181
177
|
entity: { name: data.roleName },
|
|
182
178
|
}, data.timeout || this.timeout);
|
|
183
179
|
return promise;
|
|
184
180
|
});
|
|
185
181
|
}
|
|
186
182
|
/**
|
|
187
|
-
*
|
|
183
|
+
* Drops a user role in Milvus.
|
|
188
184
|
*
|
|
189
|
-
* @param data
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* | roleName | String | User name |
|
|
193
|
-
* | 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 |
|
|
185
|
+
* @param {DropRoleReq} data - The data object.
|
|
186
|
+
* @param {string} data.roleName - The name of the role to be dropped.
|
|
187
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
194
188
|
*
|
|
195
|
-
* @returns
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
* | status | { error_code: number, reason: string } |
|
|
199
|
-
* | reason | '' |
|
|
189
|
+
* @returns {Promise<ResStatus>} The response status.
|
|
190
|
+
* @returns {number} ResStatus.error_code - The error code number.
|
|
191
|
+
* @returns {string} ResStatus.reason - The cause of the error, if any.
|
|
200
192
|
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```javascript
|
|
195
|
+
* milvusClient.dropRole({
|
|
196
|
+
* roleName: 'exampleRole',
|
|
197
|
+
* });
|
|
205
198
|
* ```
|
|
206
199
|
*/
|
|
207
200
|
dropRole(data) {
|
|
208
201
|
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
-
const promise = yield (0, __1.promisify)(this.
|
|
202
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'DropRole', {
|
|
210
203
|
role_name: data.roleName,
|
|
211
204
|
}, data.timeout || this.timeout);
|
|
212
205
|
return promise;
|
|
213
206
|
});
|
|
214
207
|
}
|
|
215
208
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* @param data
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
* @returns
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
* ```
|
|
234
|
-
* milvusClient.addUserToRole({username: 'my', roleName: 'myrole'});
|
|
209
|
+
* Adds a user to a role.
|
|
210
|
+
*
|
|
211
|
+
* @param {AddUserToRoleReq} data - The data object.
|
|
212
|
+
* @param {string} data.username - The username of the user to be added to the role.
|
|
213
|
+
* @param {string} data.roleName - The name of the role to which the user will be added.
|
|
214
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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
|
+
* @returns {Promise<ResStatus>} The response status.
|
|
217
|
+
* @returns {number} ResStatus.error_code - The error code number.
|
|
218
|
+
* @returns {string} ResStatus.reason - The cause of the error, if any.
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```javascript
|
|
222
|
+
* milvusClient.addUserToRole({
|
|
223
|
+
* username: 'my',
|
|
224
|
+
* roleName: 'myrole'
|
|
225
|
+
* });
|
|
235
226
|
* ```
|
|
236
227
|
*/
|
|
237
228
|
addUserToRole(data) {
|
|
238
229
|
return __awaiter(this, void 0, void 0, function* () {
|
|
239
|
-
const promise = yield (0, __1.promisify)(this.
|
|
230
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'OperateUserRole', {
|
|
240
231
|
username: data.username,
|
|
241
232
|
role_name: data.roleName,
|
|
242
233
|
type: __1.OperateUserRoleType.AddUserToRole,
|
|
@@ -245,30 +236,28 @@ class User extends Resource_1.Resource {
|
|
|
245
236
|
});
|
|
246
237
|
}
|
|
247
238
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
* @param data
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
* @returns
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
* ```
|
|
266
|
-
* milvusClient.removeUserFromRole({username: 'my', roleName: 'myrole'});
|
|
239
|
+
* Removes a user from a role.
|
|
240
|
+
*
|
|
241
|
+
* @param {RemoveUserFromRoleReq} data - The data object.
|
|
242
|
+
* @param {string} data.username - The username of the user to be removed from the role.
|
|
243
|
+
* @param {string} data.roleName - The name of the role from which the user will be removed.
|
|
244
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
245
|
+
*
|
|
246
|
+
* @returns {Promise<ResStatus>} The response status.
|
|
247
|
+
* @returns {number} ResStatus.error_code - The error code number.
|
|
248
|
+
* @returns {string} ResStatus.reason - The cause of the error, if any.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```javascript
|
|
252
|
+
* milvusClient.removeUserFromRole({
|
|
253
|
+
* username: 'my',
|
|
254
|
+
* roleName: 'myrole'
|
|
255
|
+
* });
|
|
267
256
|
* ```
|
|
268
257
|
*/
|
|
269
258
|
removeUserFromRole(data) {
|
|
270
259
|
return __awaiter(this, void 0, void 0, function* () {
|
|
271
|
-
const promise = yield (0, __1.promisify)(this.
|
|
260
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'OperateUserRole', {
|
|
272
261
|
username: data.username,
|
|
273
262
|
role_name: data.roleName,
|
|
274
263
|
type: __1.OperateUserRoleType.RemoveUserFromRole,
|
|
@@ -277,30 +266,31 @@ class User extends Resource_1.Resource {
|
|
|
277
266
|
});
|
|
278
267
|
}
|
|
279
268
|
/**
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
* @param data
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
|
|
289
|
-
* @returns
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
269
|
+
* Gets all users that belong to a specified role.
|
|
270
|
+
*
|
|
271
|
+
* @param {Object} data - The data object.
|
|
272
|
+
* @param {string} data.roleName - The name of the role.
|
|
273
|
+
* @param {boolean} [data.includeUserInfo=true] - Determines whether the result should include user info.
|
|
274
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
275
|
+
*
|
|
276
|
+
* @returns {Promise<Object>} The response object.
|
|
277
|
+
* @returns {Object} response.status - The response status.
|
|
278
|
+
* @returns {number} response.status.error_code - The error code number.
|
|
279
|
+
* @returns {string} response.status.reason - The cause of the error, if any.
|
|
280
|
+
* @returns {Object[]} response.results - An array of objects, each containing a list of users and a role.
|
|
281
|
+
* @returns {Object[]} response.results.users - An array of user objects.
|
|
282
|
+
* @returns {string} response.results.users.name - The name of the user.
|
|
283
|
+
* @returns {Object} response.results.role - The role object.
|
|
284
|
+
* @returns {string} response.results.role.name - The name of the role.
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```javascript
|
|
288
|
+
* milvusClient.describeRole({roleName: 'myrole'});
|
|
299
289
|
* ```
|
|
300
290
|
*/
|
|
301
|
-
|
|
291
|
+
describeRole(data) {
|
|
302
292
|
return __awaiter(this, void 0, void 0, function* () {
|
|
303
|
-
const promise = yield (0, __1.promisify)(this.
|
|
293
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'SelectRole', {
|
|
304
294
|
role: { name: data.roleName },
|
|
305
295
|
include_user_info: data.includeUserInfo || true,
|
|
306
296
|
}, data.timeout || this.timeout);
|
|
@@ -308,58 +298,57 @@ class User extends Resource_1.Resource {
|
|
|
308
298
|
});
|
|
309
299
|
}
|
|
310
300
|
/**
|
|
311
|
-
*
|
|
301
|
+
* Lists all roles in Milvus.
|
|
312
302
|
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
* | :-- | :-- | :-- |
|
|
316
|
-
* | 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 |
|
|
303
|
+
* @param {Object} data - The data object.
|
|
304
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
317
305
|
*
|
|
318
|
-
* @returns
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
306
|
+
* @returns {Promise<Object>} The response object.
|
|
307
|
+
* @returns {Object} response.status - The response status.
|
|
308
|
+
* @returns {number} response.status.error_code - The error code number.
|
|
309
|
+
* @returns {string} response.status.reason - The cause of the error, if any.
|
|
310
|
+
* @returns {Object[]} response.results - An array of objects, each containing a role.
|
|
311
|
+
* @returns {string} response.results.role.name - The name of the role.
|
|
323
312
|
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
* ```
|
|
313
|
+
* @example
|
|
314
|
+
* ```javascript
|
|
327
315
|
* milvusClient.listRoles();
|
|
328
316
|
* ```
|
|
329
317
|
*/
|
|
330
318
|
listRoles(data) {
|
|
331
319
|
return __awaiter(this, void 0, void 0, function* () {
|
|
332
|
-
const promise = yield (0, __1.promisify)(this.
|
|
320
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'SelectRole', {
|
|
333
321
|
include_user_info: (data === null || data === void 0 ? void 0 : data.includeUserInfo) || true,
|
|
334
322
|
}, (data === null || data === void 0 ? void 0 : data.timeout) || this.timeout);
|
|
335
323
|
return promise;
|
|
336
324
|
});
|
|
337
325
|
}
|
|
338
326
|
/**
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
* @returns
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
327
|
+
* Gets all users that belong to a specified role.
|
|
328
|
+
*
|
|
329
|
+
* @param {Object} data - The data object.
|
|
330
|
+
* @param {string} data.userName - The username of the user.
|
|
331
|
+
* @param {boolean} [data.includeUserInfo=true] - Determines whether the result should include user info.
|
|
332
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
333
|
+
*
|
|
334
|
+
* @returns {Promise<Object>} The response object.
|
|
335
|
+
* @returns {Object} response.status - The response status.
|
|
336
|
+
* @returns {number} response.status.error_code - The error code number.
|
|
337
|
+
* @returns {string} response.status.reason - The cause of the error, if any.
|
|
338
|
+
* @returns {Object[]} response.results - An array of objects, each containing a user and a list of roles.
|
|
339
|
+
* @returns {Object} response.results.user - The user object.
|
|
340
|
+
* @returns {string} response.results.user.name - The name of the user.
|
|
341
|
+
* @returns {Object[]} response.results.roles - An array of role objects.
|
|
342
|
+
* @returns {string} response.results.roles.name - The name of the role.
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* ```javascript
|
|
346
|
+
* milvusClient.describeUser({username: 'name'});
|
|
358
347
|
* ```
|
|
359
348
|
*/
|
|
360
|
-
|
|
349
|
+
describeUser(data) {
|
|
361
350
|
return __awaiter(this, void 0, void 0, function* () {
|
|
362
|
-
const promise = yield (0, __1.promisify)(this.
|
|
351
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'SelectUser', {
|
|
363
352
|
user: { name: data.username },
|
|
364
353
|
include_role_info: data.includeRoleInfo || true,
|
|
365
354
|
}, data.timeout || this.timeout);
|
|
@@ -367,37 +356,33 @@ class User extends Resource_1.Resource {
|
|
|
367
356
|
});
|
|
368
357
|
}
|
|
369
358
|
/**
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
* @returns
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
* #### Example
|
|
388
|
-
*
|
|
389
|
-
* ```
|
|
390
|
-
* milvusClient.grantRolePrivilege({
|
|
359
|
+
* Grants privileges to a role.
|
|
360
|
+
*
|
|
361
|
+
* @param {Object} data - The data object.
|
|
362
|
+
* @param {string} data.roleName - The name of the role.
|
|
363
|
+
* @param {string} data.object - The type of the operational object to which the specified privilege belongs, such as Collection, Index, Partition, etc. This parameter is case-sensitive.
|
|
364
|
+
* @param {string} data.objectName - The name of the object to which the role is granted the specified privilege.
|
|
365
|
+
* @param {string} data.privilegeName - The name of the privilege to be granted to the role. This parameter is case-sensitive.
|
|
366
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
367
|
+
*
|
|
368
|
+
* @returns {Promise<Object>} The response object.
|
|
369
|
+
* @returns {Object} response.status - The response status.
|
|
370
|
+
* @returns {number} response.status.error_code - The error code number.
|
|
371
|
+
* @returns {string} response.status.reason - The cause of the error, if any.
|
|
372
|
+
*
|
|
373
|
+
* @example
|
|
374
|
+
* ```javascript
|
|
375
|
+
* milvusClient.grantPrivilege({
|
|
391
376
|
* roleName: 'roleName',
|
|
392
377
|
* object: '*',
|
|
393
378
|
* objectName: 'Collection',
|
|
394
379
|
* privilegeName: 'CreateIndex'
|
|
395
|
-
*
|
|
380
|
+
* });
|
|
396
381
|
* ```
|
|
397
382
|
*/
|
|
398
|
-
|
|
383
|
+
grantPrivilege(data) {
|
|
399
384
|
return __awaiter(this, void 0, void 0, function* () {
|
|
400
|
-
const promise = yield (0, __1.promisify)(this.
|
|
385
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'OperatePrivilege', {
|
|
401
386
|
entity: {
|
|
402
387
|
role: { name: data.roleName },
|
|
403
388
|
object: { name: data.object },
|
|
@@ -412,37 +397,33 @@ class User extends Resource_1.Resource {
|
|
|
412
397
|
});
|
|
413
398
|
}
|
|
414
399
|
/**
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
* @returns
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
* #### Example
|
|
433
|
-
*
|
|
434
|
-
* ```
|
|
435
|
-
* milvusClient.grantRolePrivilege({
|
|
400
|
+
* Revokes privileges from a role.
|
|
401
|
+
*
|
|
402
|
+
* @param {Object} data - The data object.
|
|
403
|
+
* @param {string} data.roleName - The name of the role.
|
|
404
|
+
* @param {string} data.object - The type of the operational object from which the specified privilege is revoked, such as Collection, Index, Partition, etc. This parameter is case-sensitive.
|
|
405
|
+
* @param {string} data.objectName - The name of the object from which the role's specified privilege is revoked.
|
|
406
|
+
* @param {string} data.privilegeName - The name of the privilege to be revoked from the role. This parameter is case-sensitive.
|
|
407
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
408
|
+
*
|
|
409
|
+
* @returns {Promise<Object>} The response object.
|
|
410
|
+
* @returns {Object} response.status - The response status.
|
|
411
|
+
* @returns {number} response.status.error_code - The error code number.
|
|
412
|
+
* @returns {string} response.status.reason - The cause of the error, if any.
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* ```javascript
|
|
416
|
+
* milvusClient.revokePrivilege({
|
|
436
417
|
* roleName: 'roleName',
|
|
437
418
|
* object: '*',
|
|
438
419
|
* objectName: 'Collection',
|
|
439
420
|
* privilegeName: 'CreateIndex'
|
|
440
|
-
*
|
|
421
|
+
* });
|
|
441
422
|
* ```
|
|
442
423
|
*/
|
|
443
|
-
|
|
424
|
+
revokePrivilege(data) {
|
|
444
425
|
return __awaiter(this, void 0, void 0, function* () {
|
|
445
|
-
const promise = yield (0, __1.promisify)(this.
|
|
426
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'OperatePrivilege', {
|
|
446
427
|
entity: {
|
|
447
428
|
role: { name: data.roleName },
|
|
448
429
|
object: { name: data.object },
|
|
@@ -457,21 +438,17 @@ class User extends Resource_1.Resource {
|
|
|
457
438
|
});
|
|
458
439
|
}
|
|
459
440
|
/**
|
|
460
|
-
*
|
|
461
|
-
* @param data
|
|
462
|
-
* | Property | Type | Description |
|
|
463
|
-
* | :-- | :-- | :-- |
|
|
464
|
-
* | 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 |
|
|
441
|
+
* Revokes all privileges from all roles.
|
|
465
442
|
*
|
|
466
|
-
* @
|
|
467
|
-
*
|
|
468
|
-
* | :-- | :-- |
|
|
469
|
-
* | status | { error_code: number, reason: string } |
|
|
470
|
-
* | reason | '' |
|
|
443
|
+
* @param {Object} data - The data object.
|
|
444
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
471
445
|
*
|
|
472
|
-
*
|
|
446
|
+
* @returns {Promise<ResStatus[]>} - An array of response statuses for each role.
|
|
447
|
+
* @returns {number} ResStatus.error_code - The error code number for each role.
|
|
448
|
+
* @returns {string} ResStatus.reason - The cause of the error, if any, for each role.
|
|
473
449
|
*
|
|
474
|
-
*
|
|
450
|
+
* @example
|
|
451
|
+
* ```javascript
|
|
475
452
|
* milvusClient.revokeAllRolesPrivileges();
|
|
476
453
|
* ```
|
|
477
454
|
*/
|
|
@@ -511,36 +488,33 @@ class User extends Resource_1.Resource {
|
|
|
511
488
|
});
|
|
512
489
|
}
|
|
513
490
|
/**
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
*
|
|
522
|
-
*
|
|
523
|
-
*
|
|
524
|
-
* @returns
|
|
525
|
-
*
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
*
|
|
529
|
-
*
|
|
530
|
-
* #### Example
|
|
531
|
-
*
|
|
532
|
-
* ```
|
|
491
|
+
* Selects a grant for a specific role.
|
|
492
|
+
*
|
|
493
|
+
* @param {Object} data - The data object.
|
|
494
|
+
* @param {string} data.roleName - The name of the role.
|
|
495
|
+
* @param {string} data.object - The type of the operational object to which the specified privilege belongs, such as Collection, Index, Partition, etc. This parameter is case-sensitive.
|
|
496
|
+
* @param {string} data.objectName - The name of the object to which the role is granted the specified privilege.
|
|
497
|
+
* @param {string} data.privilegeName - The name of the privilege to be granted to the role. This parameter is case-sensitive.
|
|
498
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
499
|
+
*
|
|
500
|
+
* @returns {Promise<Object>} The response object.
|
|
501
|
+
* @returns {Object} response.status - The response status.
|
|
502
|
+
* @returns {number} response.status.error_code - The error code number.
|
|
503
|
+
* @returns {string} response.status.reason - The cause of the error, if any.
|
|
504
|
+
*
|
|
505
|
+
* @example
|
|
506
|
+
* ```javascript
|
|
533
507
|
* milvusClient.selectGrant({
|
|
534
508
|
* roleName: 'roleName',
|
|
535
509
|
* object: '*',
|
|
536
510
|
* objectName: 'Collection',
|
|
537
511
|
* privilegeName: 'CreateIndex'
|
|
538
|
-
*
|
|
512
|
+
* });
|
|
539
513
|
* ```
|
|
540
514
|
*/
|
|
541
515
|
selectGrant(data) {
|
|
542
516
|
return __awaiter(this, void 0, void 0, function* () {
|
|
543
|
-
const promise = yield (0, __1.promisify)(this.
|
|
517
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'SelectGrant', {
|
|
544
518
|
entity: {
|
|
545
519
|
role: { name: data.roleName },
|
|
546
520
|
object: { name: data.object },
|
|
@@ -554,30 +528,35 @@ class User extends Resource_1.Resource {
|
|
|
554
528
|
});
|
|
555
529
|
}
|
|
556
530
|
/**
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
*
|
|
560
|
-
*
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
* @returns
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
*
|
|
531
|
+
* Lists all grants for a specific role.
|
|
532
|
+
*
|
|
533
|
+
* @param {Object} data - The data object.
|
|
534
|
+
* @param {string} data.roleName - The name of the role.
|
|
535
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
536
|
+
*
|
|
537
|
+
* @returns {Promise<SelectGrantResponse>} The response object.
|
|
538
|
+
* @returns {Object} response.status - The response status.
|
|
539
|
+
* @returns {number} response.status.error_code - The error code number.
|
|
540
|
+
* @returns {string} response.status.reason - The cause of the error, if any.
|
|
541
|
+
* @returns {Object[]} response.entities - An array of entities, each containing a role, an object, an object name, and a grantor.
|
|
542
|
+
* @returns {Object} response.entities.role - The role object.
|
|
543
|
+
* @returns {string} response.entities.role.name - The name of the role.
|
|
544
|
+
* @returns {Object} response.entities.object - The object to which the specified privilege belongs.
|
|
545
|
+
* @returns {string} response.entities.object.name - The name of the object.
|
|
546
|
+
* @returns {string} response.entities.object_name - The name of the object to which the role is granted the specified privilege.
|
|
547
|
+
* @returns {Object} response.entities.grantor - The grantor object.
|
|
548
|
+
* @returns {string} response.entities.grantor.privilege.name - The name of the privilege granted to the role.
|
|
549
|
+
*
|
|
550
|
+
* @example
|
|
551
|
+
* ```javascript
|
|
573
552
|
* milvusClient.listGrants({
|
|
574
553
|
* roleName: 'roleName',
|
|
575
|
-
*
|
|
554
|
+
* });
|
|
576
555
|
* ```
|
|
577
556
|
*/
|
|
578
557
|
listGrants(data) {
|
|
579
558
|
return __awaiter(this, void 0, void 0, function* () {
|
|
580
|
-
const promise = yield (0, __1.promisify)(this.
|
|
559
|
+
const promise = yield (0, __1.promisify)(this.channelPool, 'SelectGrant', {
|
|
581
560
|
entity: {
|
|
582
561
|
role: { name: data.roleName },
|
|
583
562
|
},
|
|
@@ -586,25 +565,23 @@ class User extends Resource_1.Resource {
|
|
|
586
565
|
});
|
|
587
566
|
}
|
|
588
567
|
/**
|
|
589
|
-
*
|
|
590
|
-
* @param data
|
|
591
|
-
* | Property | Type | Description |
|
|
592
|
-
* | :-- | :-- | :-- |
|
|
593
|
-
* | roleName | String | Role name |
|
|
594
|
-
* | 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 |
|
|
568
|
+
* Checks if a role exists.
|
|
595
569
|
*
|
|
596
|
-
* @
|
|
597
|
-
*
|
|
598
|
-
*
|
|
599
|
-
* | status | { error_code: number, reason: string } |
|
|
600
|
-
* | reason | '' |
|
|
570
|
+
* @param {HasRoleReq} data - The data object.
|
|
571
|
+
* @param {string} data.roleName - The name of the role.
|
|
572
|
+
* @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
|
|
601
573
|
*
|
|
602
|
-
*
|
|
574
|
+
* @returns {Promise<HasRoleResponse>} The response object.
|
|
575
|
+
* @returns {ResStatus} response.status - The response status.
|
|
576
|
+
* @returns {number} response.status.error_code - The error code number.
|
|
577
|
+
* @returns {string} response.status.reason - The cause of the error, if any.
|
|
578
|
+
* @returns {boolean} response.hasRole - A boolean indicating whether the role exists.
|
|
603
579
|
*
|
|
604
|
-
*
|
|
580
|
+
* @example
|
|
581
|
+
* ```javascript
|
|
605
582
|
* milvusClient.hasRole({
|
|
606
583
|
* roleName: 'roleName',
|
|
607
|
-
*
|
|
584
|
+
* });
|
|
608
585
|
* ```
|
|
609
586
|
*/
|
|
610
587
|
hasRole(data) {
|