@databricks/sdk-uc-registeredmodels 0.1.0-dev.3 → 0.1.0-dev.4
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/dist/v1/model.d.ts +7 -6
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +9 -9
- package/dist/v1/model.js.map +1 -1
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +2 -1
- package/dist/v1/utils.js.map +1 -1
- package/package.json +4 -5
- package/src/v1/client.ts +0 -634
- package/src/v1/index.ts +0 -34
- package/src/v1/model.ts +0 -849
- package/src/v1/transport.ts +0 -73
- package/src/v1/utils.ts +0 -156
package/src/v1/client.ts
DELETED
|
@@ -1,634 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';
|
|
4
|
-
import {createDefault} from '@databricks/sdk-core/clientinfo';
|
|
5
|
-
import type {Logger} from '@databricks/sdk-core/logger';
|
|
6
|
-
import {NoOpLogger} from '@databricks/sdk-core/logger';
|
|
7
|
-
import type {CallOptions} from '@databricks/sdk-options/call';
|
|
8
|
-
import type {ClientOptions} from '@databricks/sdk-options/client';
|
|
9
|
-
import type {HttpClient} from '@databricks/sdk-core/http';
|
|
10
|
-
import {newHttpClient} from './transport';
|
|
11
|
-
import {
|
|
12
|
-
buildHttpRequest,
|
|
13
|
-
executeCall,
|
|
14
|
-
executeHttpCall,
|
|
15
|
-
marshalRequest,
|
|
16
|
-
parseResponse,
|
|
17
|
-
} from './utils';
|
|
18
|
-
import pkgJson from '../../package.json' with {type: 'json'};
|
|
19
|
-
import type {
|
|
20
|
-
CreateRegisteredModelRequest,
|
|
21
|
-
DeleteModelVersionRequest,
|
|
22
|
-
DeleteModelVersionResponse,
|
|
23
|
-
DeleteRegisteredModelAliasRequest,
|
|
24
|
-
DeleteRegisteredModelAliasResponse,
|
|
25
|
-
DeleteRegisteredModelRequest,
|
|
26
|
-
DeleteRegisteredModelResponse,
|
|
27
|
-
GetModelVersionByAliasRequest,
|
|
28
|
-
GetModelVersionRequest,
|
|
29
|
-
GetRegisteredModelRequest,
|
|
30
|
-
ListModelVersionsRequest,
|
|
31
|
-
ListModelVersionsResponse,
|
|
32
|
-
ListRegisteredModelsRequest,
|
|
33
|
-
ListRegisteredModelsResponse,
|
|
34
|
-
ModelVersionInfo,
|
|
35
|
-
RegisteredModelAliasInfo,
|
|
36
|
-
RegisteredModelInfo,
|
|
37
|
-
SetRegisteredModelAliasRequest,
|
|
38
|
-
UpdateModelVersionRequest,
|
|
39
|
-
UpdateRegisteredModelRequest,
|
|
40
|
-
} from './model';
|
|
41
|
-
import {
|
|
42
|
-
marshalCreateRegisteredModelRequestSchema,
|
|
43
|
-
marshalSetRegisteredModelAliasRequestSchema,
|
|
44
|
-
marshalUpdateModelVersionRequestSchema,
|
|
45
|
-
marshalUpdateRegisteredModelRequestSchema,
|
|
46
|
-
unmarshalDeleteModelVersionResponseSchema,
|
|
47
|
-
unmarshalDeleteRegisteredModelAliasResponseSchema,
|
|
48
|
-
unmarshalDeleteRegisteredModelResponseSchema,
|
|
49
|
-
unmarshalListModelVersionsResponseSchema,
|
|
50
|
-
unmarshalListRegisteredModelsResponseSchema,
|
|
51
|
-
unmarshalModelVersionInfoSchema,
|
|
52
|
-
unmarshalRegisteredModelAliasInfoSchema,
|
|
53
|
-
unmarshalRegisteredModelInfoSchema,
|
|
54
|
-
} from './model';
|
|
55
|
-
|
|
56
|
-
// Package identity segment for this client to be used in the User-Agent header.
|
|
57
|
-
const PACKAGE_SEGMENT = {
|
|
58
|
-
key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
|
|
59
|
-
value: pkgJson.version,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export class RegisteredModelsClient {
|
|
63
|
-
private readonly host: string;
|
|
64
|
-
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
65
|
-
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
66
|
-
// request.
|
|
67
|
-
private readonly workspaceId: string | undefined;
|
|
68
|
-
private readonly httpClient: HttpClient;
|
|
69
|
-
private readonly logger: Logger;
|
|
70
|
-
// User-Agent header value. Composed once at construction from
|
|
71
|
-
// createDefault() merged with this package's identity and the active
|
|
72
|
-
// credential's name.
|
|
73
|
-
private readonly userAgent: string;
|
|
74
|
-
|
|
75
|
-
constructor(options: ClientOptions) {
|
|
76
|
-
if (options.host === undefined) {
|
|
77
|
-
throw new Error('Host is required.');
|
|
78
|
-
}
|
|
79
|
-
this.host = options.host.replace(/\/$/, '');
|
|
80
|
-
this.workspaceId = options.workspaceId;
|
|
81
|
-
this.logger = options.logger ?? new NoOpLogger();
|
|
82
|
-
const info = createDefault()
|
|
83
|
-
.with(PACKAGE_SEGMENT)
|
|
84
|
-
.with({key: 'sdk-js-auth', value: AUTH_VERSION})
|
|
85
|
-
.with({key: 'auth', value: options.credentials?.name() ?? 'default'});
|
|
86
|
-
this.userAgent = info.toString();
|
|
87
|
-
this.httpClient = newHttpClient(options);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Creates a new registered model in Unity Catalog.
|
|
92
|
-
*
|
|
93
|
-
* File storage for model versions in the registered model
|
|
94
|
-
* will be located in the default location which is specified by the parent schema,
|
|
95
|
-
* or the parent catalog, or the Metastore.
|
|
96
|
-
*
|
|
97
|
-
* For registered model creation to succeed, the user must satisfy the following conditions:
|
|
98
|
-
* - The caller must be a metastore admin, or be the owner of the parent catalog and schema,
|
|
99
|
-
* or have the **USE_CATALOG** privilege on the parent catalog
|
|
100
|
-
* and the **USE_SCHEMA** privilege on the parent schema.
|
|
101
|
-
* - The caller must have the **CREATE MODEL** or **CREATE FUNCTION** privilege on the parent schema.
|
|
102
|
-
*/
|
|
103
|
-
async createRegisteredModel(
|
|
104
|
-
req: CreateRegisteredModelRequest,
|
|
105
|
-
options?: CallOptions
|
|
106
|
-
): Promise<RegisteredModelInfo> {
|
|
107
|
-
const url = `${this.host}/api/2.1/unity-catalog/models`;
|
|
108
|
-
const body = marshalRequest(req, marshalCreateRegisteredModelRequestSchema);
|
|
109
|
-
let resp: RegisteredModelInfo | undefined;
|
|
110
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
111
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
112
|
-
if (this.workspaceId !== undefined) {
|
|
113
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
114
|
-
}
|
|
115
|
-
headers.set('User-Agent', this.userAgent);
|
|
116
|
-
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
117
|
-
const respBody = await executeHttpCall({
|
|
118
|
-
request: httpReq,
|
|
119
|
-
httpClient: this.httpClient,
|
|
120
|
-
logger: this.logger,
|
|
121
|
-
});
|
|
122
|
-
resp = parseResponse(respBody, unmarshalRegisteredModelInfoSchema);
|
|
123
|
-
};
|
|
124
|
-
await executeCall(call, options);
|
|
125
|
-
if (resp === undefined) {
|
|
126
|
-
throw new Error('operation completed without a result.');
|
|
127
|
-
}
|
|
128
|
-
return resp;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Deletes a model version from the specified registered model. Any aliases assigned to the
|
|
133
|
-
* model version will also be deleted.
|
|
134
|
-
*
|
|
135
|
-
* The caller must be a metastore admin or an owner of the parent registered model.
|
|
136
|
-
* For the latter case, the caller must also be the owner or have the **USE_CATALOG**
|
|
137
|
-
* privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema.
|
|
138
|
-
*/
|
|
139
|
-
async deleteModelVersion(
|
|
140
|
-
req: DeleteModelVersionRequest,
|
|
141
|
-
options?: CallOptions
|
|
142
|
-
): Promise<DeleteModelVersionResponse> {
|
|
143
|
-
const url = `${this.host}/api/2.1/unity-catalog/models/${req.fullNameArg ?? ''}/versions/${String(req.versionArg ?? '')}`;
|
|
144
|
-
let resp: DeleteModelVersionResponse | undefined;
|
|
145
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
146
|
-
const headers = new Headers();
|
|
147
|
-
if (this.workspaceId !== undefined) {
|
|
148
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
149
|
-
}
|
|
150
|
-
headers.set('User-Agent', this.userAgent);
|
|
151
|
-
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
152
|
-
const respBody = await executeHttpCall({
|
|
153
|
-
request: httpReq,
|
|
154
|
-
httpClient: this.httpClient,
|
|
155
|
-
logger: this.logger,
|
|
156
|
-
});
|
|
157
|
-
resp = parseResponse(respBody, unmarshalDeleteModelVersionResponseSchema);
|
|
158
|
-
};
|
|
159
|
-
await executeCall(call, options);
|
|
160
|
-
if (resp === undefined) {
|
|
161
|
-
throw new Error('operation completed without a result.');
|
|
162
|
-
}
|
|
163
|
-
return resp;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Deletes a registered model and all its model versions from the specified parent catalog and schema.
|
|
168
|
-
*
|
|
169
|
-
* The caller must be a metastore admin or an owner of the registered model.
|
|
170
|
-
* For the latter case, the caller must also be the owner or have the **USE_CATALOG**
|
|
171
|
-
* privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema.
|
|
172
|
-
*/
|
|
173
|
-
async deleteRegisteredModel(
|
|
174
|
-
req: DeleteRegisteredModelRequest,
|
|
175
|
-
options?: CallOptions
|
|
176
|
-
): Promise<DeleteRegisteredModelResponse> {
|
|
177
|
-
const url = `${this.host}/api/2.1/unity-catalog/models/${req.fullNameArg ?? ''}`;
|
|
178
|
-
let resp: DeleteRegisteredModelResponse | undefined;
|
|
179
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
180
|
-
const headers = new Headers();
|
|
181
|
-
if (this.workspaceId !== undefined) {
|
|
182
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
183
|
-
}
|
|
184
|
-
headers.set('User-Agent', this.userAgent);
|
|
185
|
-
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
186
|
-
const respBody = await executeHttpCall({
|
|
187
|
-
request: httpReq,
|
|
188
|
-
httpClient: this.httpClient,
|
|
189
|
-
logger: this.logger,
|
|
190
|
-
});
|
|
191
|
-
resp = parseResponse(
|
|
192
|
-
respBody,
|
|
193
|
-
unmarshalDeleteRegisteredModelResponseSchema
|
|
194
|
-
);
|
|
195
|
-
};
|
|
196
|
-
await executeCall(call, options);
|
|
197
|
-
if (resp === undefined) {
|
|
198
|
-
throw new Error('operation completed without a result.');
|
|
199
|
-
}
|
|
200
|
-
return resp;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Deletes a registered model alias.
|
|
205
|
-
*
|
|
206
|
-
* The caller must be a metastore admin or an owner of the registered model.
|
|
207
|
-
* For the latter case, the caller must also be the owner or have the **USE_CATALOG**
|
|
208
|
-
* privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema.
|
|
209
|
-
*/
|
|
210
|
-
async deleteRegisteredModelAlias(
|
|
211
|
-
req: DeleteRegisteredModelAliasRequest,
|
|
212
|
-
options?: CallOptions
|
|
213
|
-
): Promise<DeleteRegisteredModelAliasResponse> {
|
|
214
|
-
const url = `${this.host}/api/2.1/unity-catalog/models/${req.fullNameArg ?? ''}/aliases/${req.aliasArg ?? ''}`;
|
|
215
|
-
let resp: DeleteRegisteredModelAliasResponse | undefined;
|
|
216
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
217
|
-
const headers = new Headers();
|
|
218
|
-
if (this.workspaceId !== undefined) {
|
|
219
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
220
|
-
}
|
|
221
|
-
headers.set('User-Agent', this.userAgent);
|
|
222
|
-
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
223
|
-
const respBody = await executeHttpCall({
|
|
224
|
-
request: httpReq,
|
|
225
|
-
httpClient: this.httpClient,
|
|
226
|
-
logger: this.logger,
|
|
227
|
-
});
|
|
228
|
-
resp = parseResponse(
|
|
229
|
-
respBody,
|
|
230
|
-
unmarshalDeleteRegisteredModelAliasResponseSchema
|
|
231
|
-
);
|
|
232
|
-
};
|
|
233
|
-
await executeCall(call, options);
|
|
234
|
-
if (resp === undefined) {
|
|
235
|
-
throw new Error('operation completed without a result.');
|
|
236
|
-
}
|
|
237
|
-
return resp;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Get a model version.
|
|
242
|
-
*
|
|
243
|
-
* The caller must be a metastore admin or an owner of (or have the **EXECUTE**
|
|
244
|
-
* privilege on) the parent registered model. For the latter case, the caller must also be the owner
|
|
245
|
-
* or have the **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** privilege
|
|
246
|
-
* on the parent schema.
|
|
247
|
-
*/
|
|
248
|
-
async getModelVersion(
|
|
249
|
-
req: GetModelVersionRequest,
|
|
250
|
-
options?: CallOptions
|
|
251
|
-
): Promise<ModelVersionInfo> {
|
|
252
|
-
const url = `${this.host}/api/2.1/unity-catalog/models/${req.fullNameArg ?? ''}/versions/${String(req.versionArg ?? '')}`;
|
|
253
|
-
const params = new URLSearchParams();
|
|
254
|
-
if (req.includeAliases !== undefined) {
|
|
255
|
-
params.append('include_aliases', String(req.includeAliases));
|
|
256
|
-
}
|
|
257
|
-
if (req.includeBrowse !== undefined) {
|
|
258
|
-
params.append('include_browse', String(req.includeBrowse));
|
|
259
|
-
}
|
|
260
|
-
const query = params.toString();
|
|
261
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
262
|
-
let resp: ModelVersionInfo | undefined;
|
|
263
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
264
|
-
const headers = new Headers();
|
|
265
|
-
if (this.workspaceId !== undefined) {
|
|
266
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
267
|
-
}
|
|
268
|
-
headers.set('User-Agent', this.userAgent);
|
|
269
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
270
|
-
const respBody = await executeHttpCall({
|
|
271
|
-
request: httpReq,
|
|
272
|
-
httpClient: this.httpClient,
|
|
273
|
-
logger: this.logger,
|
|
274
|
-
});
|
|
275
|
-
resp = parseResponse(respBody, unmarshalModelVersionInfoSchema);
|
|
276
|
-
};
|
|
277
|
-
await executeCall(call, options);
|
|
278
|
-
if (resp === undefined) {
|
|
279
|
-
throw new Error('operation completed without a result.');
|
|
280
|
-
}
|
|
281
|
-
return resp;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Get a model version by alias.
|
|
286
|
-
*
|
|
287
|
-
* The caller must be a metastore admin or an owner of (or have the **EXECUTE**
|
|
288
|
-
* privilege on) the registered model. For the latter case, the caller must also be the owner
|
|
289
|
-
* or have the **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** privilege
|
|
290
|
-
* on the parent schema.
|
|
291
|
-
*/
|
|
292
|
-
async getModelVersionByAlias(
|
|
293
|
-
req: GetModelVersionByAliasRequest,
|
|
294
|
-
options?: CallOptions
|
|
295
|
-
): Promise<ModelVersionInfo> {
|
|
296
|
-
const url = `${this.host}/api/2.1/unity-catalog/models/${req.fullNameArg ?? ''}/aliases/${req.aliasArg ?? ''}`;
|
|
297
|
-
const params = new URLSearchParams();
|
|
298
|
-
if (req.includeAliases !== undefined) {
|
|
299
|
-
params.append('include_aliases', String(req.includeAliases));
|
|
300
|
-
}
|
|
301
|
-
const query = params.toString();
|
|
302
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
303
|
-
let resp: ModelVersionInfo | undefined;
|
|
304
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
305
|
-
const headers = new Headers();
|
|
306
|
-
if (this.workspaceId !== undefined) {
|
|
307
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
308
|
-
}
|
|
309
|
-
headers.set('User-Agent', this.userAgent);
|
|
310
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
311
|
-
const respBody = await executeHttpCall({
|
|
312
|
-
request: httpReq,
|
|
313
|
-
httpClient: this.httpClient,
|
|
314
|
-
logger: this.logger,
|
|
315
|
-
});
|
|
316
|
-
resp = parseResponse(respBody, unmarshalModelVersionInfoSchema);
|
|
317
|
-
};
|
|
318
|
-
await executeCall(call, options);
|
|
319
|
-
if (resp === undefined) {
|
|
320
|
-
throw new Error('operation completed without a result.');
|
|
321
|
-
}
|
|
322
|
-
return resp;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Get a registered model.
|
|
327
|
-
*
|
|
328
|
-
* The caller must be a metastore admin or an owner of (or have the **EXECUTE**
|
|
329
|
-
* privilege on) the registered model. For the latter case, the caller must also be the owner
|
|
330
|
-
* or have the **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** privilege
|
|
331
|
-
* on the parent schema.
|
|
332
|
-
*/
|
|
333
|
-
async getRegisteredModel(
|
|
334
|
-
req: GetRegisteredModelRequest,
|
|
335
|
-
options?: CallOptions
|
|
336
|
-
): Promise<RegisteredModelInfo> {
|
|
337
|
-
const url = `${this.host}/api/2.1/unity-catalog/models/${req.fullNameArg ?? ''}`;
|
|
338
|
-
const params = new URLSearchParams();
|
|
339
|
-
if (req.includeAliases !== undefined) {
|
|
340
|
-
params.append('include_aliases', String(req.includeAliases));
|
|
341
|
-
}
|
|
342
|
-
if (req.includeBrowse !== undefined) {
|
|
343
|
-
params.append('include_browse', String(req.includeBrowse));
|
|
344
|
-
}
|
|
345
|
-
const query = params.toString();
|
|
346
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
347
|
-
let resp: RegisteredModelInfo | undefined;
|
|
348
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
349
|
-
const headers = new Headers();
|
|
350
|
-
if (this.workspaceId !== undefined) {
|
|
351
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
352
|
-
}
|
|
353
|
-
headers.set('User-Agent', this.userAgent);
|
|
354
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
355
|
-
const respBody = await executeHttpCall({
|
|
356
|
-
request: httpReq,
|
|
357
|
-
httpClient: this.httpClient,
|
|
358
|
-
logger: this.logger,
|
|
359
|
-
});
|
|
360
|
-
resp = parseResponse(respBody, unmarshalRegisteredModelInfoSchema);
|
|
361
|
-
};
|
|
362
|
-
await executeCall(call, options);
|
|
363
|
-
if (resp === undefined) {
|
|
364
|
-
throw new Error('operation completed without a result.');
|
|
365
|
-
}
|
|
366
|
-
return resp;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* List model versions. You can list model versions under a particular schema,
|
|
371
|
-
* or list all model versions in the current metastore.
|
|
372
|
-
*
|
|
373
|
-
* The returned models are filtered based on the privileges of the calling user.
|
|
374
|
-
* For example, the metastore admin is able to list all the model versions.
|
|
375
|
-
* A regular user needs to be the owner or have the **EXECUTE** privilege
|
|
376
|
-
* on the parent registered model to recieve the model versions in the response.
|
|
377
|
-
* For the latter case, the caller must also be the owner or have the **USE_CATALOG**
|
|
378
|
-
* privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema.
|
|
379
|
-
*
|
|
380
|
-
* There is no guarantee of a specific ordering of the elements in the response. The
|
|
381
|
-
* elements in the response will not contain any aliases or tags.
|
|
382
|
-
*
|
|
383
|
-
* PAGINATION BEHAVIOR: The API is by default paginated, a page may contain zero results while still providing a next_page_token.
|
|
384
|
-
* Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
|
|
385
|
-
*/
|
|
386
|
-
async listModelVersions(
|
|
387
|
-
req: ListModelVersionsRequest,
|
|
388
|
-
options?: CallOptions
|
|
389
|
-
): Promise<ListModelVersionsResponse> {
|
|
390
|
-
const url = `${this.host}/api/2.1/unity-catalog/models/${req.fullNameArg ?? ''}/versions`;
|
|
391
|
-
const params = new URLSearchParams();
|
|
392
|
-
if (req.maxResults !== undefined) {
|
|
393
|
-
params.append('max_results', String(req.maxResults));
|
|
394
|
-
}
|
|
395
|
-
if (req.pageToken !== undefined) {
|
|
396
|
-
params.append('page_token', req.pageToken);
|
|
397
|
-
}
|
|
398
|
-
if (req.includeBrowse !== undefined) {
|
|
399
|
-
params.append('include_browse', String(req.includeBrowse));
|
|
400
|
-
}
|
|
401
|
-
const query = params.toString();
|
|
402
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
403
|
-
let resp: ListModelVersionsResponse | undefined;
|
|
404
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
405
|
-
const headers = new Headers();
|
|
406
|
-
if (this.workspaceId !== undefined) {
|
|
407
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
408
|
-
}
|
|
409
|
-
headers.set('User-Agent', this.userAgent);
|
|
410
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
411
|
-
const respBody = await executeHttpCall({
|
|
412
|
-
request: httpReq,
|
|
413
|
-
httpClient: this.httpClient,
|
|
414
|
-
logger: this.logger,
|
|
415
|
-
});
|
|
416
|
-
resp = parseResponse(respBody, unmarshalListModelVersionsResponseSchema);
|
|
417
|
-
};
|
|
418
|
-
await executeCall(call, options);
|
|
419
|
-
if (resp === undefined) {
|
|
420
|
-
throw new Error('operation completed without a result.');
|
|
421
|
-
}
|
|
422
|
-
return resp;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
async *listModelVersionsIter(
|
|
426
|
-
req: ListModelVersionsRequest,
|
|
427
|
-
options?: CallOptions
|
|
428
|
-
): AsyncGenerator<ModelVersionInfo> {
|
|
429
|
-
const pageReq: ListModelVersionsRequest = {...req};
|
|
430
|
-
for (;;) {
|
|
431
|
-
const resp = await this.listModelVersions(pageReq, options);
|
|
432
|
-
for (const item of resp.modelVersions ?? []) {
|
|
433
|
-
yield item;
|
|
434
|
-
}
|
|
435
|
-
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
438
|
-
pageReq.pageToken = resp.nextPageToken;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* List registered models. You can list registered models under a particular schema,
|
|
444
|
-
* or list all registered models in the current metastore.
|
|
445
|
-
*
|
|
446
|
-
* The returned models are filtered based on the privileges of the calling user.
|
|
447
|
-
* For example, the metastore admin is able to list all the registered models.
|
|
448
|
-
* A regular user needs to be the owner or have the **EXECUTE** privilege
|
|
449
|
-
* on the registered model to recieve the registered models in the response.
|
|
450
|
-
* For the latter case, the caller must also be the owner or have the **USE_CATALOG**
|
|
451
|
-
* privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema.
|
|
452
|
-
*
|
|
453
|
-
* There is no guarantee of a specific ordering of the elements in the response.
|
|
454
|
-
*
|
|
455
|
-
* PAGINATION BEHAVIOR: The API is by default paginated, a page may contain zero results while still providing a next_page_token.
|
|
456
|
-
* Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
|
|
457
|
-
*/
|
|
458
|
-
async listRegisteredModels(
|
|
459
|
-
req: ListRegisteredModelsRequest,
|
|
460
|
-
options?: CallOptions
|
|
461
|
-
): Promise<ListRegisteredModelsResponse> {
|
|
462
|
-
const url = `${this.host}/api/2.1/unity-catalog/models`;
|
|
463
|
-
const params = new URLSearchParams();
|
|
464
|
-
if (req.catalogName !== undefined) {
|
|
465
|
-
params.append('catalog_name', req.catalogName);
|
|
466
|
-
}
|
|
467
|
-
if (req.schemaName !== undefined) {
|
|
468
|
-
params.append('schema_name', req.schemaName);
|
|
469
|
-
}
|
|
470
|
-
if (req.includeBrowse !== undefined) {
|
|
471
|
-
params.append('include_browse', String(req.includeBrowse));
|
|
472
|
-
}
|
|
473
|
-
if (req.maxResults !== undefined) {
|
|
474
|
-
params.append('max_results', String(req.maxResults));
|
|
475
|
-
}
|
|
476
|
-
if (req.pageToken !== undefined) {
|
|
477
|
-
params.append('page_token', req.pageToken);
|
|
478
|
-
}
|
|
479
|
-
const query = params.toString();
|
|
480
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
481
|
-
let resp: ListRegisteredModelsResponse | undefined;
|
|
482
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
483
|
-
const headers = new Headers();
|
|
484
|
-
if (this.workspaceId !== undefined) {
|
|
485
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
486
|
-
}
|
|
487
|
-
headers.set('User-Agent', this.userAgent);
|
|
488
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
489
|
-
const respBody = await executeHttpCall({
|
|
490
|
-
request: httpReq,
|
|
491
|
-
httpClient: this.httpClient,
|
|
492
|
-
logger: this.logger,
|
|
493
|
-
});
|
|
494
|
-
resp = parseResponse(
|
|
495
|
-
respBody,
|
|
496
|
-
unmarshalListRegisteredModelsResponseSchema
|
|
497
|
-
);
|
|
498
|
-
};
|
|
499
|
-
await executeCall(call, options);
|
|
500
|
-
if (resp === undefined) {
|
|
501
|
-
throw new Error('operation completed without a result.');
|
|
502
|
-
}
|
|
503
|
-
return resp;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
async *listRegisteredModelsIter(
|
|
507
|
-
req: ListRegisteredModelsRequest,
|
|
508
|
-
options?: CallOptions
|
|
509
|
-
): AsyncGenerator<RegisteredModelInfo> {
|
|
510
|
-
const pageReq: ListRegisteredModelsRequest = {...req};
|
|
511
|
-
for (;;) {
|
|
512
|
-
const resp = await this.listRegisteredModels(pageReq, options);
|
|
513
|
-
for (const item of resp.registeredModels ?? []) {
|
|
514
|
-
yield item;
|
|
515
|
-
}
|
|
516
|
-
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
517
|
-
return;
|
|
518
|
-
}
|
|
519
|
-
pageReq.pageToken = resp.nextPageToken;
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
/**
|
|
524
|
-
* Set an alias on the specified registered model.
|
|
525
|
-
*
|
|
526
|
-
* The caller must be a metastore admin or an owner of the registered model.
|
|
527
|
-
* For the latter case, the caller must also be the owner or have the **USE_CATALOG**
|
|
528
|
-
* privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema.
|
|
529
|
-
*/
|
|
530
|
-
async setRegisteredModelAlias(
|
|
531
|
-
req: SetRegisteredModelAliasRequest,
|
|
532
|
-
options?: CallOptions
|
|
533
|
-
): Promise<RegisteredModelAliasInfo> {
|
|
534
|
-
const url = `${this.host}/api/2.1/unity-catalog/models/${req.fullNameArg ?? ''}/aliases/${req.aliasArg ?? ''}`;
|
|
535
|
-
const body = marshalRequest(
|
|
536
|
-
req,
|
|
537
|
-
marshalSetRegisteredModelAliasRequestSchema
|
|
538
|
-
);
|
|
539
|
-
let resp: RegisteredModelAliasInfo | undefined;
|
|
540
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
541
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
542
|
-
if (this.workspaceId !== undefined) {
|
|
543
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
544
|
-
}
|
|
545
|
-
headers.set('User-Agent', this.userAgent);
|
|
546
|
-
const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
|
|
547
|
-
const respBody = await executeHttpCall({
|
|
548
|
-
request: httpReq,
|
|
549
|
-
httpClient: this.httpClient,
|
|
550
|
-
logger: this.logger,
|
|
551
|
-
});
|
|
552
|
-
resp = parseResponse(respBody, unmarshalRegisteredModelAliasInfoSchema);
|
|
553
|
-
};
|
|
554
|
-
await executeCall(call, options);
|
|
555
|
-
if (resp === undefined) {
|
|
556
|
-
throw new Error('operation completed without a result.');
|
|
557
|
-
}
|
|
558
|
-
return resp;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* Updates the specified model version.
|
|
563
|
-
*
|
|
564
|
-
* The caller must be a metastore admin or an owner of the parent registered model.
|
|
565
|
-
* For the latter case, the caller must also be the owner or have the **USE_CATALOG**
|
|
566
|
-
* privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema.
|
|
567
|
-
*
|
|
568
|
-
* Currently only the comment of the model version can be updated.
|
|
569
|
-
*/
|
|
570
|
-
async updateModelVersion(
|
|
571
|
-
req: UpdateModelVersionRequest,
|
|
572
|
-
options?: CallOptions
|
|
573
|
-
): Promise<ModelVersionInfo> {
|
|
574
|
-
const url = `${this.host}/api/2.1/unity-catalog/models/${req.fullNameArg ?? ''}/versions/${String(req.versionArg ?? '')}`;
|
|
575
|
-
const body = marshalRequest(req, marshalUpdateModelVersionRequestSchema);
|
|
576
|
-
let resp: ModelVersionInfo | undefined;
|
|
577
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
578
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
579
|
-
if (this.workspaceId !== undefined) {
|
|
580
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
581
|
-
}
|
|
582
|
-
headers.set('User-Agent', this.userAgent);
|
|
583
|
-
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
584
|
-
const respBody = await executeHttpCall({
|
|
585
|
-
request: httpReq,
|
|
586
|
-
httpClient: this.httpClient,
|
|
587
|
-
logger: this.logger,
|
|
588
|
-
});
|
|
589
|
-
resp = parseResponse(respBody, unmarshalModelVersionInfoSchema);
|
|
590
|
-
};
|
|
591
|
-
await executeCall(call, options);
|
|
592
|
-
if (resp === undefined) {
|
|
593
|
-
throw new Error('operation completed without a result.');
|
|
594
|
-
}
|
|
595
|
-
return resp;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* Updates the specified registered model.
|
|
600
|
-
*
|
|
601
|
-
* The caller must be a metastore admin or an owner of the registered model.
|
|
602
|
-
* For the latter case, the caller must also be the owner or have the **USE_CATALOG**
|
|
603
|
-
* privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema.
|
|
604
|
-
*
|
|
605
|
-
* Currently only the name, the owner or the comment of the registered model can be updated.
|
|
606
|
-
*/
|
|
607
|
-
async updateRegisteredModel(
|
|
608
|
-
req: UpdateRegisteredModelRequest,
|
|
609
|
-
options?: CallOptions
|
|
610
|
-
): Promise<RegisteredModelInfo> {
|
|
611
|
-
const url = `${this.host}/api/2.1/unity-catalog/models/${req.fullNameArg ?? ''}`;
|
|
612
|
-
const body = marshalRequest(req, marshalUpdateRegisteredModelRequestSchema);
|
|
613
|
-
let resp: RegisteredModelInfo | undefined;
|
|
614
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
615
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
616
|
-
if (this.workspaceId !== undefined) {
|
|
617
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
618
|
-
}
|
|
619
|
-
headers.set('User-Agent', this.userAgent);
|
|
620
|
-
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
621
|
-
const respBody = await executeHttpCall({
|
|
622
|
-
request: httpReq,
|
|
623
|
-
httpClient: this.httpClient,
|
|
624
|
-
logger: this.logger,
|
|
625
|
-
});
|
|
626
|
-
resp = parseResponse(respBody, unmarshalRegisteredModelInfoSchema);
|
|
627
|
-
};
|
|
628
|
-
await executeCall(call, options);
|
|
629
|
-
if (resp === undefined) {
|
|
630
|
-
throw new Error('operation completed without a result.');
|
|
631
|
-
}
|
|
632
|
-
return resp;
|
|
633
|
-
}
|
|
634
|
-
}
|
package/src/v1/index.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
export {RegisteredModelsClient} from './client';
|
|
4
|
-
|
|
5
|
-
export {ModelVersionStatus} from './model';
|
|
6
|
-
|
|
7
|
-
export type {
|
|
8
|
-
ConnectionDependency,
|
|
9
|
-
CreateRegisteredModelRequest,
|
|
10
|
-
CredentialDependency,
|
|
11
|
-
DeleteModelVersionRequest,
|
|
12
|
-
DeleteModelVersionResponse,
|
|
13
|
-
DeleteRegisteredModelAliasRequest,
|
|
14
|
-
DeleteRegisteredModelAliasResponse,
|
|
15
|
-
DeleteRegisteredModelRequest,
|
|
16
|
-
DeleteRegisteredModelResponse,
|
|
17
|
-
Dependency,
|
|
18
|
-
DependencyList,
|
|
19
|
-
FunctionDependency,
|
|
20
|
-
GetModelVersionByAliasRequest,
|
|
21
|
-
GetModelVersionRequest,
|
|
22
|
-
GetRegisteredModelRequest,
|
|
23
|
-
ListModelVersionsRequest,
|
|
24
|
-
ListModelVersionsResponse,
|
|
25
|
-
ListRegisteredModelsRequest,
|
|
26
|
-
ListRegisteredModelsResponse,
|
|
27
|
-
ModelVersionInfo,
|
|
28
|
-
RegisteredModelAliasInfo,
|
|
29
|
-
RegisteredModelInfo,
|
|
30
|
-
SetRegisteredModelAliasRequest,
|
|
31
|
-
TableDependency,
|
|
32
|
-
UpdateModelVersionRequest,
|
|
33
|
-
UpdateRegisteredModelRequest,
|
|
34
|
-
} from './model';
|