@databricks/sdk-uc-externalmetadata 0.0.0-dev → 0.1.0-dev.2
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/LICENSE +203 -0
- package/dist/v1/client.d.ts +41 -0
- package/dist/v1/client.d.ts.map +1 -0
- package/dist/v1/client.js +203 -0
- package/dist/v1/client.js.map +1 -0
- package/dist/v1/index.d.ts +5 -0
- package/dist/v1/index.d.ts.map +1 -0
- package/dist/v1/index.js +5 -0
- package/dist/v1/index.js.map +1 -0
- package/dist/v1/model.d.ts +94 -0
- package/dist/v1/model.d.ts.map +1 -0
- package/dist/v1/model.js +140 -0
- package/dist/v1/model.js.map +1 -0
- package/dist/v1/transport.d.ts +5 -0
- package/dist/v1/transport.d.ts.map +1 -0
- package/dist/v1/transport.js +57 -0
- package/dist/v1/transport.js.map +1 -0
- package/dist/v1/utils.d.ts +21 -0
- package/dist/v1/utils.d.ts.map +1 -0
- package/dist/v1/utils.js +113 -0
- package/dist/v1/utils.js.map +1 -0
- package/package.json +38 -4
- package/src/v1/client.ts +268 -0
- package/src/v1/index.ts +18 -0
- package/src/v1/model.ts +221 -0
- package/src/v1/transport.ts +73 -0
- package/src/v1/utils.ts +156 -0
- package/README.md +0 -1
- package/index.js +0 -1
package/src/v1/client.ts
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
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
|
+
CreateExternalMetadataRequest,
|
|
21
|
+
DeleteExternalMetadataRequest,
|
|
22
|
+
ExternalMetadata,
|
|
23
|
+
GetExternalMetadataRequest,
|
|
24
|
+
ListExternalMetadataRequest,
|
|
25
|
+
ListExternalMetadataResponseV2,
|
|
26
|
+
UpdateExternalMetadataRequest,
|
|
27
|
+
} from './model';
|
|
28
|
+
import {
|
|
29
|
+
marshalExternalMetadataSchema,
|
|
30
|
+
unmarshalExternalMetadataSchema,
|
|
31
|
+
unmarshalListExternalMetadataResponseV2Schema,
|
|
32
|
+
} from './model';
|
|
33
|
+
|
|
34
|
+
// Package identity segment for this client to be used in the User-Agent header.
|
|
35
|
+
const PACKAGE_SEGMENT = {
|
|
36
|
+
key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
|
|
37
|
+
value: pkgJson.version,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export class ExternalMetadataClient {
|
|
41
|
+
private readonly host: string;
|
|
42
|
+
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
43
|
+
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
44
|
+
// request.
|
|
45
|
+
private readonly workspaceId: string | undefined;
|
|
46
|
+
private readonly httpClient: HttpClient;
|
|
47
|
+
private readonly logger: Logger;
|
|
48
|
+
// User-Agent header value. Composed once at construction from
|
|
49
|
+
// createDefault() merged with this package's identity and the active
|
|
50
|
+
// credential's name.
|
|
51
|
+
private readonly userAgent: string;
|
|
52
|
+
|
|
53
|
+
constructor(options: ClientOptions) {
|
|
54
|
+
if (options.host === undefined) {
|
|
55
|
+
throw new Error('Host is required.');
|
|
56
|
+
}
|
|
57
|
+
this.host = options.host.replace(/\/$/, '');
|
|
58
|
+
this.workspaceId = options.workspaceId;
|
|
59
|
+
this.logger = options.logger ?? new NoOpLogger();
|
|
60
|
+
const info = createDefault()
|
|
61
|
+
.with(PACKAGE_SEGMENT)
|
|
62
|
+
.with({key: 'sdk-js-auth', value: AUTH_VERSION})
|
|
63
|
+
.with({key: 'auth', value: options.credentials?.name() ?? 'default'});
|
|
64
|
+
this.userAgent = info.toString();
|
|
65
|
+
this.httpClient = newHttpClient(options);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Creates a new external metadata object in the parent metastore if the caller is a metastore admin or has the **CREATE_EXTERNAL_METADATA** privilege.
|
|
70
|
+
* Grants **BROWSE** to all account users upon creation by default.
|
|
71
|
+
*/
|
|
72
|
+
async createExternalMetadataV2(
|
|
73
|
+
req: CreateExternalMetadataRequest,
|
|
74
|
+
options?: CallOptions
|
|
75
|
+
): Promise<ExternalMetadata> {
|
|
76
|
+
const url = `${this.host}/api/2.0/lineage-tracking/external-metadata`;
|
|
77
|
+
const body = marshalRequest(
|
|
78
|
+
req.externalMetadata,
|
|
79
|
+
marshalExternalMetadataSchema
|
|
80
|
+
);
|
|
81
|
+
let resp: ExternalMetadata | undefined;
|
|
82
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
83
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
84
|
+
if (this.workspaceId !== undefined) {
|
|
85
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
86
|
+
}
|
|
87
|
+
headers.set('User-Agent', this.userAgent);
|
|
88
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
89
|
+
const respBody = await executeHttpCall({
|
|
90
|
+
request: httpReq,
|
|
91
|
+
httpClient: this.httpClient,
|
|
92
|
+
logger: this.logger,
|
|
93
|
+
});
|
|
94
|
+
resp = parseResponse(respBody, unmarshalExternalMetadataSchema);
|
|
95
|
+
};
|
|
96
|
+
await executeCall(call, options);
|
|
97
|
+
if (resp === undefined) {
|
|
98
|
+
throw new Error('operation completed without a result.');
|
|
99
|
+
}
|
|
100
|
+
return resp;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Deletes the external metadata object that matches the supplied name.
|
|
105
|
+
* The caller must be a metastore admin, the owner of the external metadata object, or a user that has the **MANAGE** privilege.
|
|
106
|
+
*/
|
|
107
|
+
async deleteExternalMetadataV2(
|
|
108
|
+
req: DeleteExternalMetadataRequest,
|
|
109
|
+
options?: CallOptions
|
|
110
|
+
): Promise<void> {
|
|
111
|
+
const url = `${this.host}/api/2.0/lineage-tracking/external-metadata/${req.name ?? ''}`;
|
|
112
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
113
|
+
const headers = new Headers();
|
|
114
|
+
if (this.workspaceId !== undefined) {
|
|
115
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
116
|
+
}
|
|
117
|
+
headers.set('User-Agent', this.userAgent);
|
|
118
|
+
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
119
|
+
await executeHttpCall({
|
|
120
|
+
request: httpReq,
|
|
121
|
+
httpClient: this.httpClient,
|
|
122
|
+
logger: this.logger,
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
await executeCall(call, options);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Gets the specified external metadata object in a metastore.
|
|
130
|
+
* The caller must be a metastore admin, the owner of the external metadata object, or a user that has the **BROWSE** privilege.
|
|
131
|
+
*/
|
|
132
|
+
async getExternalMetadataV2(
|
|
133
|
+
req: GetExternalMetadataRequest,
|
|
134
|
+
options?: CallOptions
|
|
135
|
+
): Promise<ExternalMetadata> {
|
|
136
|
+
const url = `${this.host}/api/2.0/lineage-tracking/external-metadata/${req.name ?? ''}`;
|
|
137
|
+
let resp: ExternalMetadata | undefined;
|
|
138
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
139
|
+
const headers = new Headers();
|
|
140
|
+
if (this.workspaceId !== undefined) {
|
|
141
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
142
|
+
}
|
|
143
|
+
headers.set('User-Agent', this.userAgent);
|
|
144
|
+
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
145
|
+
const respBody = await executeHttpCall({
|
|
146
|
+
request: httpReq,
|
|
147
|
+
httpClient: this.httpClient,
|
|
148
|
+
logger: this.logger,
|
|
149
|
+
});
|
|
150
|
+
resp = parseResponse(respBody, unmarshalExternalMetadataSchema);
|
|
151
|
+
};
|
|
152
|
+
await executeCall(call, options);
|
|
153
|
+
if (resp === undefined) {
|
|
154
|
+
throw new Error('operation completed without a result.');
|
|
155
|
+
}
|
|
156
|
+
return resp;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Gets an array of external metadata objects in the metastore.
|
|
161
|
+
* If the caller is the metastore admin, all external metadata objects will be retrieved.
|
|
162
|
+
* Otherwise, only external metadata objects that the caller has **BROWSE** on will be retrieved.
|
|
163
|
+
* There is no guarantee of a specific ordering of the elements in the array.
|
|
164
|
+
*/
|
|
165
|
+
async listExternalMetadataV2(
|
|
166
|
+
req: ListExternalMetadataRequest,
|
|
167
|
+
options?: CallOptions
|
|
168
|
+
): Promise<ListExternalMetadataResponseV2> {
|
|
169
|
+
const url = `${this.host}/api/2.0/lineage-tracking/external-metadata`;
|
|
170
|
+
const params = new URLSearchParams();
|
|
171
|
+
if (req.pageSize !== undefined) {
|
|
172
|
+
params.append('page_size', String(req.pageSize));
|
|
173
|
+
}
|
|
174
|
+
if (req.pageToken !== undefined) {
|
|
175
|
+
params.append('page_token', req.pageToken);
|
|
176
|
+
}
|
|
177
|
+
const query = params.toString();
|
|
178
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
179
|
+
let resp: ListExternalMetadataResponseV2 | undefined;
|
|
180
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
181
|
+
const headers = new Headers();
|
|
182
|
+
if (this.workspaceId !== undefined) {
|
|
183
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
184
|
+
}
|
|
185
|
+
headers.set('User-Agent', this.userAgent);
|
|
186
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
187
|
+
const respBody = await executeHttpCall({
|
|
188
|
+
request: httpReq,
|
|
189
|
+
httpClient: this.httpClient,
|
|
190
|
+
logger: this.logger,
|
|
191
|
+
});
|
|
192
|
+
resp = parseResponse(
|
|
193
|
+
respBody,
|
|
194
|
+
unmarshalListExternalMetadataResponseV2Schema
|
|
195
|
+
);
|
|
196
|
+
};
|
|
197
|
+
await executeCall(call, options);
|
|
198
|
+
if (resp === undefined) {
|
|
199
|
+
throw new Error('operation completed without a result.');
|
|
200
|
+
}
|
|
201
|
+
return resp;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async *listExternalMetadataV2Iter(
|
|
205
|
+
req: ListExternalMetadataRequest,
|
|
206
|
+
options?: CallOptions
|
|
207
|
+
): AsyncGenerator<ExternalMetadata> {
|
|
208
|
+
const pageReq: ListExternalMetadataRequest = {...req};
|
|
209
|
+
for (;;) {
|
|
210
|
+
const resp = await this.listExternalMetadataV2(pageReq, options);
|
|
211
|
+
for (const item of resp.externalMetadata ?? []) {
|
|
212
|
+
yield item;
|
|
213
|
+
}
|
|
214
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Updates the external metadata object that matches the supplied name. The caller can only update either the owner or other metadata fields in one request.
|
|
223
|
+
* The caller must be a metastore admin, the owner of the external metadata object, or a user that has the **MODIFY** privilege.
|
|
224
|
+
* If the caller is updating the owner, they must also have the **MANAGE** privilege.
|
|
225
|
+
*/
|
|
226
|
+
async updateExternalMetadataV2(
|
|
227
|
+
req: UpdateExternalMetadataRequest,
|
|
228
|
+
options?: CallOptions
|
|
229
|
+
): Promise<ExternalMetadata> {
|
|
230
|
+
const url = `${this.host}/api/2.0/lineage-tracking/external-metadata/${req.externalMetadata?.name ?? ''}`;
|
|
231
|
+
const params = new URLSearchParams();
|
|
232
|
+
if (req.updateMask !== undefined) {
|
|
233
|
+
params.append('update_mask', req.updateMask.toString());
|
|
234
|
+
}
|
|
235
|
+
const query = params.toString();
|
|
236
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
237
|
+
const body = marshalRequest(
|
|
238
|
+
req.externalMetadata,
|
|
239
|
+
marshalExternalMetadataSchema
|
|
240
|
+
);
|
|
241
|
+
let resp: ExternalMetadata | undefined;
|
|
242
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
243
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
244
|
+
if (this.workspaceId !== undefined) {
|
|
245
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
246
|
+
}
|
|
247
|
+
headers.set('User-Agent', this.userAgent);
|
|
248
|
+
const httpReq = buildHttpRequest(
|
|
249
|
+
'PATCH',
|
|
250
|
+
fullUrl,
|
|
251
|
+
headers,
|
|
252
|
+
callSignal,
|
|
253
|
+
body
|
|
254
|
+
);
|
|
255
|
+
const respBody = await executeHttpCall({
|
|
256
|
+
request: httpReq,
|
|
257
|
+
httpClient: this.httpClient,
|
|
258
|
+
logger: this.logger,
|
|
259
|
+
});
|
|
260
|
+
resp = parseResponse(respBody, unmarshalExternalMetadataSchema);
|
|
261
|
+
};
|
|
262
|
+
await executeCall(call, options);
|
|
263
|
+
if (resp === undefined) {
|
|
264
|
+
throw new Error('operation completed without a result.');
|
|
265
|
+
}
|
|
266
|
+
return resp;
|
|
267
|
+
}
|
|
268
|
+
}
|
package/src/v1/index.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
export {ExternalMetadataClient} from './client';
|
|
4
|
+
|
|
5
|
+
export {SystemType} from './model';
|
|
6
|
+
|
|
7
|
+
export type {
|
|
8
|
+
CreateExternalMetadataRequest,
|
|
9
|
+
DeleteExternalMetadataRequest,
|
|
10
|
+
ExternalMetadata,
|
|
11
|
+
ExternalMetadata_PropertiesEntry,
|
|
12
|
+
GetExternalMetadataRequest,
|
|
13
|
+
ListExternalMetadataRequest,
|
|
14
|
+
ListExternalMetadataResponseV2,
|
|
15
|
+
UpdateExternalMetadataRequest,
|
|
16
|
+
} from './model';
|
|
17
|
+
|
|
18
|
+
export {externalMetadataFieldMask} from './model';
|
package/src/v1/model.ts
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
import {Temporal} from '@js-temporal/polyfill';
|
|
4
|
+
import {FieldMask} from '@databricks/sdk-core/wkt';
|
|
5
|
+
import type {FieldMaskSchema} from '@databricks/sdk-core/wkt';
|
|
6
|
+
import {z} from 'zod';
|
|
7
|
+
|
|
8
|
+
export enum SystemType {
|
|
9
|
+
SYSTEM_TYPE_UNSPECIFIED = 'SYSTEM_TYPE_UNSPECIFIED',
|
|
10
|
+
OTHER = 'OTHER',
|
|
11
|
+
TABLEAU = 'TABLEAU',
|
|
12
|
+
POWER_BI = 'POWER_BI',
|
|
13
|
+
LOOKER = 'LOOKER',
|
|
14
|
+
KAFKA = 'KAFKA',
|
|
15
|
+
SAP = 'SAP',
|
|
16
|
+
ORACLE = 'ORACLE',
|
|
17
|
+
SALESFORCE = 'SALESFORCE',
|
|
18
|
+
WORKDAY = 'WORKDAY',
|
|
19
|
+
MYSQL = 'MYSQL',
|
|
20
|
+
POSTGRESQL = 'POSTGRESQL',
|
|
21
|
+
MICROSOFT_SQL_SERVER = 'MICROSOFT_SQL_SERVER',
|
|
22
|
+
SERVICENOW = 'SERVICENOW',
|
|
23
|
+
AMAZON_REDSHIFT = 'AMAZON_REDSHIFT',
|
|
24
|
+
AZURE_SYNAPSE = 'AZURE_SYNAPSE',
|
|
25
|
+
SNOWFLAKE = 'SNOWFLAKE',
|
|
26
|
+
GOOGLE_BIGQUERY = 'GOOGLE_BIGQUERY',
|
|
27
|
+
MICROSOFT_FABRIC = 'MICROSOFT_FABRIC',
|
|
28
|
+
MONGODB = 'MONGODB',
|
|
29
|
+
TERADATA = 'TERADATA',
|
|
30
|
+
CONFLUENT = 'CONFLUENT',
|
|
31
|
+
DATABRICKS = 'DATABRICKS',
|
|
32
|
+
STREAM_NATIVE = 'STREAM_NATIVE',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface CreateExternalMetadataRequest {
|
|
36
|
+
externalMetadata?: ExternalMetadata | undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface DeleteExternalMetadataRequest {
|
|
40
|
+
name?: string | undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface ExternalMetadata {
|
|
44
|
+
/** Name of the external metadata object. */
|
|
45
|
+
name?: string | undefined;
|
|
46
|
+
/** Type of external system. */
|
|
47
|
+
systemType?: SystemType | undefined;
|
|
48
|
+
/** Type of entity within the external system. */
|
|
49
|
+
entityType?: string | undefined;
|
|
50
|
+
/** URL associated with the external metadata object. */
|
|
51
|
+
url?: string | undefined;
|
|
52
|
+
/** User-provided free-form text description. */
|
|
53
|
+
description?: string | undefined;
|
|
54
|
+
/** List of columns associated with the external metadata object. */
|
|
55
|
+
columns?: string[] | undefined;
|
|
56
|
+
/** A map of key-value properties attached to the external metadata object. */
|
|
57
|
+
properties?: Record<string, string> | undefined;
|
|
58
|
+
/** Owner of the external metadata object. */
|
|
59
|
+
owner?: string | undefined;
|
|
60
|
+
/** Unique identifier of parent metastore. */
|
|
61
|
+
metastoreId?: string | undefined;
|
|
62
|
+
/** Time at which this external metadata object was created. */
|
|
63
|
+
createTime?: Temporal.Instant | undefined;
|
|
64
|
+
/** Username of external metadata object creator. */
|
|
65
|
+
createdBy?: string | undefined;
|
|
66
|
+
/** Time at which this external metadata object was last modified. */
|
|
67
|
+
updateTime?: Temporal.Instant | undefined;
|
|
68
|
+
/** Username of user who last modified external metadata object. */
|
|
69
|
+
updatedBy?: string | undefined;
|
|
70
|
+
/** Unique identifier of the external metadata object. */
|
|
71
|
+
id?: string | undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
|
|
75
|
+
export interface ExternalMetadata_PropertiesEntry {
|
|
76
|
+
key?: string | undefined;
|
|
77
|
+
value?: string | undefined;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface GetExternalMetadataRequest {
|
|
81
|
+
name?: string | undefined;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface ListExternalMetadataRequest {
|
|
85
|
+
/**
|
|
86
|
+
* Specifies the maximum number of external metadata objects to return in a single response.
|
|
87
|
+
* The value must be less than or equal to 1000.
|
|
88
|
+
*/
|
|
89
|
+
pageSize?: number | undefined;
|
|
90
|
+
/** Opaque pagination token to go to next page based on previous query. */
|
|
91
|
+
pageToken?: string | undefined;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface ListExternalMetadataResponseV2 {
|
|
95
|
+
externalMetadata?: ExternalMetadata[] | undefined;
|
|
96
|
+
nextPageToken?: string | undefined;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface UpdateExternalMetadataRequest {
|
|
100
|
+
externalMetadata?: ExternalMetadata | undefined;
|
|
101
|
+
updateMask?: FieldMask<ExternalMetadata> | undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export const unmarshalExternalMetadataSchema: z.ZodType<ExternalMetadata> = z
|
|
105
|
+
.object({
|
|
106
|
+
name: z.string().optional(),
|
|
107
|
+
system_type: z.enum(SystemType).optional(),
|
|
108
|
+
entity_type: z.string().optional(),
|
|
109
|
+
url: z.string().optional(),
|
|
110
|
+
description: z.string().optional(),
|
|
111
|
+
columns: z.array(z.string()).optional(),
|
|
112
|
+
properties: z.record(z.string(), z.string()).optional(),
|
|
113
|
+
owner: z.string().optional(),
|
|
114
|
+
metastore_id: z.string().optional(),
|
|
115
|
+
create_time: z
|
|
116
|
+
.string()
|
|
117
|
+
.transform(s => Temporal.Instant.from(s))
|
|
118
|
+
.optional(),
|
|
119
|
+
created_by: z.string().optional(),
|
|
120
|
+
update_time: z
|
|
121
|
+
.string()
|
|
122
|
+
.transform(s => Temporal.Instant.from(s))
|
|
123
|
+
.optional(),
|
|
124
|
+
updated_by: z.string().optional(),
|
|
125
|
+
id: z.string().optional(),
|
|
126
|
+
})
|
|
127
|
+
.transform(d => ({
|
|
128
|
+
name: d.name,
|
|
129
|
+
systemType: d.system_type,
|
|
130
|
+
entityType: d.entity_type,
|
|
131
|
+
url: d.url,
|
|
132
|
+
description: d.description,
|
|
133
|
+
columns: d.columns,
|
|
134
|
+
properties: d.properties,
|
|
135
|
+
owner: d.owner,
|
|
136
|
+
metastoreId: d.metastore_id,
|
|
137
|
+
createTime: d.create_time,
|
|
138
|
+
createdBy: d.created_by,
|
|
139
|
+
updateTime: d.update_time,
|
|
140
|
+
updatedBy: d.updated_by,
|
|
141
|
+
id: d.id,
|
|
142
|
+
}));
|
|
143
|
+
|
|
144
|
+
export const unmarshalListExternalMetadataResponseV2Schema: z.ZodType<ListExternalMetadataResponseV2> =
|
|
145
|
+
z
|
|
146
|
+
.object({
|
|
147
|
+
external_metadata: z
|
|
148
|
+
.array(z.lazy(() => unmarshalExternalMetadataSchema))
|
|
149
|
+
.optional(),
|
|
150
|
+
next_page_token: z.string().optional(),
|
|
151
|
+
})
|
|
152
|
+
.transform(d => ({
|
|
153
|
+
externalMetadata: d.external_metadata,
|
|
154
|
+
nextPageToken: d.next_page_token,
|
|
155
|
+
}));
|
|
156
|
+
|
|
157
|
+
export const marshalExternalMetadataSchema: z.ZodType = z
|
|
158
|
+
.object({
|
|
159
|
+
name: z.string().optional(),
|
|
160
|
+
systemType: z.enum(SystemType).optional(),
|
|
161
|
+
entityType: z.string().optional(),
|
|
162
|
+
url: z.string().optional(),
|
|
163
|
+
description: z.string().optional(),
|
|
164
|
+
columns: z.array(z.string()).optional(),
|
|
165
|
+
properties: z.record(z.string(), z.string()).optional(),
|
|
166
|
+
owner: z.string().optional(),
|
|
167
|
+
metastoreId: z.string().optional(),
|
|
168
|
+
createTime: z
|
|
169
|
+
.any()
|
|
170
|
+
.transform((d: Temporal.Instant) => d.toString())
|
|
171
|
+
.optional(),
|
|
172
|
+
createdBy: z.string().optional(),
|
|
173
|
+
updateTime: z
|
|
174
|
+
.any()
|
|
175
|
+
.transform((d: Temporal.Instant) => d.toString())
|
|
176
|
+
.optional(),
|
|
177
|
+
updatedBy: z.string().optional(),
|
|
178
|
+
id: z.string().optional(),
|
|
179
|
+
})
|
|
180
|
+
.transform(d => ({
|
|
181
|
+
name: d.name,
|
|
182
|
+
system_type: d.systemType,
|
|
183
|
+
entity_type: d.entityType,
|
|
184
|
+
url: d.url,
|
|
185
|
+
description: d.description,
|
|
186
|
+
columns: d.columns,
|
|
187
|
+
properties: d.properties,
|
|
188
|
+
owner: d.owner,
|
|
189
|
+
metastore_id: d.metastoreId,
|
|
190
|
+
create_time: d.createTime,
|
|
191
|
+
created_by: d.createdBy,
|
|
192
|
+
update_time: d.updateTime,
|
|
193
|
+
updated_by: d.updatedBy,
|
|
194
|
+
id: d.id,
|
|
195
|
+
}));
|
|
196
|
+
|
|
197
|
+
const externalMetadataFieldMaskSchema: FieldMaskSchema = {
|
|
198
|
+
columns: {wire: 'columns'},
|
|
199
|
+
createTime: {wire: 'create_time'},
|
|
200
|
+
createdBy: {wire: 'created_by'},
|
|
201
|
+
description: {wire: 'description'},
|
|
202
|
+
entityType: {wire: 'entity_type'},
|
|
203
|
+
id: {wire: 'id'},
|
|
204
|
+
metastoreId: {wire: 'metastore_id'},
|
|
205
|
+
name: {wire: 'name'},
|
|
206
|
+
owner: {wire: 'owner'},
|
|
207
|
+
properties: {wire: 'properties'},
|
|
208
|
+
systemType: {wire: 'system_type'},
|
|
209
|
+
updateTime: {wire: 'update_time'},
|
|
210
|
+
updatedBy: {wire: 'updated_by'},
|
|
211
|
+
url: {wire: 'url'},
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export function externalMetadataFieldMask(
|
|
215
|
+
...paths: string[]
|
|
216
|
+
): FieldMask<ExternalMetadata> {
|
|
217
|
+
return FieldMask.build<ExternalMetadata>(
|
|
218
|
+
paths,
|
|
219
|
+
externalMetadataFieldMaskSchema
|
|
220
|
+
);
|
|
221
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
import type {Credentials} from '@databricks/sdk-auth';
|
|
4
|
+
import {defaultCredentials} from '@databricks/sdk-auth/credentials';
|
|
5
|
+
import type {
|
|
6
|
+
HttpClient,
|
|
7
|
+
HttpRequest,
|
|
8
|
+
HttpResponse,
|
|
9
|
+
} from '@databricks/sdk-core/http';
|
|
10
|
+
import {newFetchHttpClient} from '@databricks/sdk-core/http';
|
|
11
|
+
import type {ClientOptions} from '@databricks/sdk-options/client';
|
|
12
|
+
|
|
13
|
+
/** Creates a new HTTP client with the given options. */
|
|
14
|
+
export function newHttpClient(options?: ClientOptions): HttpClient {
|
|
15
|
+
const opts = options ?? {};
|
|
16
|
+
|
|
17
|
+
// If an HTTP client is provided, use it as-is. Throw if other options are
|
|
18
|
+
// also set, since they would be silently ignored.
|
|
19
|
+
if (opts.httpClient !== undefined) {
|
|
20
|
+
if (opts.credentials !== undefined || opts.timeout !== undefined) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
'httpClient cannot be combined with credentials or timeout'
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
return opts.httpClient;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const credentials = opts.credentials ?? defaultCredentials();
|
|
29
|
+
|
|
30
|
+
const base = newFetchHttpClient();
|
|
31
|
+
let client: HttpClient = new AuthHttpClient(base, credentials);
|
|
32
|
+
|
|
33
|
+
if (opts.timeout !== undefined) {
|
|
34
|
+
client = new TimeoutHttpClient(client, opts.timeout);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return client;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Wraps an HttpClient and adds authentication headers to requests. */
|
|
41
|
+
class AuthHttpClient implements HttpClient {
|
|
42
|
+
constructor(
|
|
43
|
+
private readonly base: HttpClient,
|
|
44
|
+
private readonly credentials: Credentials
|
|
45
|
+
) {}
|
|
46
|
+
|
|
47
|
+
async send(request: HttpRequest): Promise<HttpResponse> {
|
|
48
|
+
const authHeaders = await this.credentials.authHeaders();
|
|
49
|
+
// Do not modify the original request.
|
|
50
|
+
const headers = new Headers(request.headers);
|
|
51
|
+
for (const h of authHeaders) {
|
|
52
|
+
headers.set(h.key, h.value);
|
|
53
|
+
}
|
|
54
|
+
return this.base.send({...request, headers});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Wraps an HttpClient and applies a default timeout to requests. */
|
|
59
|
+
class TimeoutHttpClient implements HttpClient {
|
|
60
|
+
constructor(
|
|
61
|
+
private readonly base: HttpClient,
|
|
62
|
+
private readonly timeout: number
|
|
63
|
+
) {}
|
|
64
|
+
|
|
65
|
+
async send(request: HttpRequest): Promise<HttpResponse> {
|
|
66
|
+
const timeoutSignal = AbortSignal.timeout(this.timeout);
|
|
67
|
+
const signal =
|
|
68
|
+
request.signal !== undefined
|
|
69
|
+
? AbortSignal.any([request.signal, timeoutSignal])
|
|
70
|
+
: timeoutSignal;
|
|
71
|
+
return this.base.send({...request, signal});
|
|
72
|
+
}
|
|
73
|
+
}
|