@databricks/sdk-networking 0.0.0-dev → 0.1.0-dev.1

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.
@@ -0,0 +1,1705 @@
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 type {Call} from '@databricks/sdk-core/api';
5
+ import {createDefault} from '@databricks/sdk-core/clientinfo';
6
+ import type {Logger} from '@databricks/sdk-core/logger';
7
+ import {NoOpLogger} from '@databricks/sdk-core/logger';
8
+ import type {CallOptions} from '@databricks/sdk-options/call';
9
+ import type {ClientOptions} from '@databricks/sdk-options/client';
10
+ import type {HttpClient} from '@databricks/sdk-core/http';
11
+ import {newHttpClient} from './transport';
12
+ import {
13
+ buildHttpRequest,
14
+ executeCall,
15
+ executeHttpCall,
16
+ marshalRequest,
17
+ parseResponse,
18
+ } from './utils';
19
+ import pkgJson from '../../package.json' with {type: 'json'};
20
+ import {z} from 'zod';
21
+ import type {
22
+ AccountNetworkPolicy,
23
+ CreateAccountIpAccessListRequest,
24
+ CreateAccountIpAccessListRequest_Response,
25
+ CreateEndpointRequest,
26
+ CreateIpAccessList,
27
+ CreateIpAccessList_Response,
28
+ CreateNccPrivateEndpointRuleRequest,
29
+ CreateNetworkConnectivityConfigRequest,
30
+ CreateNetworkPolicyRequest,
31
+ CreateNetworkRequest,
32
+ CreatePrivateAccessSettingsRequest,
33
+ CreateVpcEndpointRequest,
34
+ CustomerFacingNetworkConnectivityConfig,
35
+ CustomerFacingPrivateAccessSettings,
36
+ CustomerFacingVpcEndpoint,
37
+ DeleteAccountIpAccessListRequest,
38
+ DeleteAccountIpAccessListRequest_Response,
39
+ DeleteEndpointRequest,
40
+ DeleteIpAccessList,
41
+ DeleteIpAccessList_Response,
42
+ DeleteNccPrivateEndpointRuleRequest,
43
+ DeleteNetworkConnectivityConfigRequest,
44
+ DeleteNetworkPolicyRequest,
45
+ DeleteNetworkRequest,
46
+ DeletePrivateAccessSettingsRequest,
47
+ DeleteVpcEndpointRequest,
48
+ Endpoint,
49
+ GetAccountIpAccessListRequest,
50
+ GetAccountIpAccessListRequest_Response,
51
+ GetEndpointRequest,
52
+ GetIpAccessList,
53
+ GetIpAccessList_Response,
54
+ GetNccPrivateEndpointRuleRequest,
55
+ GetNetworkConnectivityConfigRequest,
56
+ GetNetworkPolicyRequest,
57
+ GetNetworkRequest,
58
+ GetPrivateAccessSettingsRequest,
59
+ GetVpcEndpointRequest,
60
+ GetWorkspaceNetworkOptionRequest,
61
+ ListAccountIpAccessListsRequest,
62
+ ListAccountIpAccessListsRequest_Response,
63
+ ListEndpointsRequest,
64
+ ListEndpointsResponse,
65
+ ListIpAccessLists,
66
+ ListIpAccessLists_Response,
67
+ ListNccPrivateEndpointRulesRequest,
68
+ ListNccPrivateEndpointRulesResponse,
69
+ ListNetworkConnectivityConfigsRequest,
70
+ ListNetworkConnectivityConfigsResponse,
71
+ ListNetworkPoliciesRequest,
72
+ ListNetworkPoliciesResponse,
73
+ ListNetworkRequest,
74
+ ListNetworkResponse,
75
+ ListPrivateAccessSettingsRequest,
76
+ ListPrivateAccessSettingsResponse,
77
+ ListVpcEndpointRequest,
78
+ ListVpcEndpointResponse,
79
+ NccPrivateEndpointRule,
80
+ Network,
81
+ ReplaceAccountIpAccessListRequest,
82
+ ReplaceAccountIpAccessListRequest_Response,
83
+ ReplaceIpAccessList,
84
+ ReplaceIpAccessList_Response,
85
+ UpdateAccountIpAccessListRequest,
86
+ UpdateAccountIpAccessListRequest_Response,
87
+ UpdateIpAccessList,
88
+ UpdateIpAccessList_Response,
89
+ UpdateNccPrivateEndpointRuleRequest,
90
+ UpdateNetworkPolicyRequest,
91
+ UpdatePrivateAccessSettingsRequest,
92
+ UpdateWorkspaceNetworkOptionRequest,
93
+ WorkspaceNetworkOption,
94
+ } from './model';
95
+ import {
96
+ marshalAccountNetworkPolicySchema,
97
+ marshalCreateAccountIpAccessListRequestSchema,
98
+ marshalCreateIpAccessListSchema,
99
+ marshalCreateNetworkConnectivityConfigurationSchema,
100
+ marshalCreateNetworkRequestSchema,
101
+ marshalCreatePrivateAccessSettingsRequestSchema,
102
+ marshalCreatePrivateEndpointRuleSchema,
103
+ marshalCreateVpcEndpointRequestSchema,
104
+ marshalCustomerFacingPrivateAccessSettingsSchema,
105
+ marshalEndpointSchema,
106
+ marshalReplaceAccountIpAccessListRequestSchema,
107
+ marshalReplaceIpAccessListSchema,
108
+ marshalUpdateAccountIpAccessListRequestSchema,
109
+ marshalUpdateIpAccessListSchema,
110
+ marshalUpdatePrivateEndpointRuleSchema,
111
+ marshalWorkspaceNetworkOptionSchema,
112
+ unmarshalAccountNetworkPolicySchema,
113
+ unmarshalCreateAccountIpAccessListRequest_ResponseSchema,
114
+ unmarshalCreateIpAccessList_ResponseSchema,
115
+ unmarshalCustomerFacingNetworkConnectivityConfigSchema,
116
+ unmarshalCustomerFacingPrivateAccessSettingsSchema,
117
+ unmarshalCustomerFacingVpcEndpointSchema,
118
+ unmarshalDeleteAccountIpAccessListRequest_ResponseSchema,
119
+ unmarshalDeleteIpAccessList_ResponseSchema,
120
+ unmarshalEndpointSchema,
121
+ unmarshalGetAccountIpAccessListRequest_ResponseSchema,
122
+ unmarshalGetIpAccessList_ResponseSchema,
123
+ unmarshalListAccountIpAccessListsRequest_ResponseSchema,
124
+ unmarshalListEndpointsResponseSchema,
125
+ unmarshalListIpAccessLists_ResponseSchema,
126
+ unmarshalListNccPrivateEndpointRulesResponseSchema,
127
+ unmarshalListNetworkConnectivityConfigsResponseSchema,
128
+ unmarshalListNetworkPoliciesResponseSchema,
129
+ unmarshalNccPrivateEndpointRuleSchema,
130
+ unmarshalNetworkSchema,
131
+ unmarshalReplaceAccountIpAccessListRequest_ResponseSchema,
132
+ unmarshalReplaceIpAccessList_ResponseSchema,
133
+ unmarshalUpdateAccountIpAccessListRequest_ResponseSchema,
134
+ unmarshalUpdateIpAccessList_ResponseSchema,
135
+ unmarshalWorkspaceNetworkOptionSchema,
136
+ } from './model';
137
+
138
+ // Package identity segment for this client to be used in the User-Agent header.
139
+ const PACKAGE_SEGMENT = {
140
+ key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
141
+ value: pkgJson.version,
142
+ };
143
+
144
+ export class NetworkingClient {
145
+ private readonly host: string;
146
+ // Fallback for endpoints whose path contains {account_id}. If the request
147
+ // already carries an accountId, that value wins.
148
+ private readonly accountId: string | undefined;
149
+ // Workspace ID used to route workspace-level calls on unified hosts (SPOG).
150
+ // When set, workspace-level methods send X-Databricks-Org-Id on every
151
+ // request.
152
+ private readonly workspaceId: string | undefined;
153
+ private readonly httpClient: HttpClient;
154
+ private readonly logger: Logger;
155
+ // User-Agent header value. Composed once at construction from
156
+ // createDefault() merged with this package's identity and the active
157
+ // credential's name.
158
+ private readonly userAgent: string;
159
+
160
+ constructor(options: ClientOptions) {
161
+ if (options.host === undefined) {
162
+ throw new Error('Host is required.');
163
+ }
164
+ this.host = options.host.replace(/\/$/, '');
165
+ this.accountId = options.accountId;
166
+ this.workspaceId = options.workspaceId;
167
+ this.logger = options.logger ?? new NoOpLogger();
168
+ const info = createDefault()
169
+ .with(PACKAGE_SEGMENT)
170
+ .with({key: 'sdk-js-auth', value: AUTH_VERSION})
171
+ .with({key: 'auth', value: options.credentials?.name() ?? 'default'});
172
+ this.userAgent = info.toString();
173
+ this.httpClient = newHttpClient(options);
174
+ }
175
+
176
+ /**
177
+ * Creates an IP access list for the account.
178
+ *
179
+ * A list can be an allow list or a block list. See the top of this file for a description of
180
+ * how the server treats allow lists and block lists at runtime.
181
+ *
182
+ * When creating or updating an IP access list:
183
+ *
184
+ * * For all allow lists and block lists combined, the API supports a maximum of 1000
185
+ * IP/CIDR values, where one CIDR counts as a single value. Attempts to exceed that number
186
+ * return error 400 with `error_code` value `QUOTA_EXCEEDED`.
187
+ * * If the new list would block the calling user's current IP, error 400 is returned with
188
+ * `error_code` value `INVALID_STATE`.
189
+ *
190
+ * It can take a few minutes for the changes to take effect.
191
+ */
192
+ async createAccountIpAccessList(
193
+ req: CreateAccountIpAccessListRequest,
194
+ options?: CallOptions
195
+ ): Promise<CreateAccountIpAccessListRequest_Response> {
196
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/ip-access-lists`;
197
+ const body = marshalRequest(
198
+ req,
199
+ marshalCreateAccountIpAccessListRequestSchema
200
+ );
201
+ let resp: CreateAccountIpAccessListRequest_Response | undefined;
202
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
203
+ const headers = new Headers({'Content-Type': 'application/json'});
204
+ headers.set('User-Agent', this.userAgent);
205
+ const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
206
+ const respBody = await executeHttpCall({
207
+ request: httpReq,
208
+ httpClient: this.httpClient,
209
+ logger: this.logger,
210
+ });
211
+ resp = parseResponse(
212
+ respBody,
213
+ unmarshalCreateAccountIpAccessListRequest_ResponseSchema
214
+ );
215
+ };
216
+ await executeCall(call, options);
217
+ if (resp === undefined) {
218
+ throw new Error('API call completed without a result.');
219
+ }
220
+ return resp;
221
+ }
222
+
223
+ /** Deletes an IP access list, specified by its list ID. */
224
+ async deleteAccountIpAccessList(
225
+ req: DeleteAccountIpAccessListRequest,
226
+ options?: CallOptions
227
+ ): Promise<DeleteAccountIpAccessListRequest_Response> {
228
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/ip-access-lists/${req.listId ?? ''}`;
229
+ let resp: DeleteAccountIpAccessListRequest_Response | undefined;
230
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
231
+ const headers = new Headers();
232
+ headers.set('User-Agent', this.userAgent);
233
+ const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
234
+ const respBody = await executeHttpCall({
235
+ request: httpReq,
236
+ httpClient: this.httpClient,
237
+ logger: this.logger,
238
+ });
239
+ resp = parseResponse(
240
+ respBody,
241
+ unmarshalDeleteAccountIpAccessListRequest_ResponseSchema
242
+ );
243
+ };
244
+ await executeCall(call, options);
245
+ if (resp === undefined) {
246
+ throw new Error('API call completed without a result.');
247
+ }
248
+ return resp;
249
+ }
250
+
251
+ /** Gets an IP access list, specified by its list ID. */
252
+ async getAccountIpAccessList(
253
+ req: GetAccountIpAccessListRequest,
254
+ options?: CallOptions
255
+ ): Promise<GetAccountIpAccessListRequest_Response> {
256
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/ip-access-lists/${req.listId ?? ''}`;
257
+ let resp: GetAccountIpAccessListRequest_Response | undefined;
258
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
259
+ const headers = new Headers();
260
+ headers.set('User-Agent', this.userAgent);
261
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
262
+ const respBody = await executeHttpCall({
263
+ request: httpReq,
264
+ httpClient: this.httpClient,
265
+ logger: this.logger,
266
+ });
267
+ resp = parseResponse(
268
+ respBody,
269
+ unmarshalGetAccountIpAccessListRequest_ResponseSchema
270
+ );
271
+ };
272
+ await executeCall(call, options);
273
+ if (resp === undefined) {
274
+ throw new Error('API call completed without a result.');
275
+ }
276
+ return resp;
277
+ }
278
+
279
+ /** Gets all IP access lists for the specified account. */
280
+ async listAccountIpAccessLists(
281
+ req: ListAccountIpAccessListsRequest,
282
+ options?: CallOptions
283
+ ): Promise<ListAccountIpAccessListsRequest_Response> {
284
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/ip-access-lists`;
285
+ let resp: ListAccountIpAccessListsRequest_Response | undefined;
286
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
287
+ const headers = new Headers();
288
+ headers.set('User-Agent', this.userAgent);
289
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
290
+ const respBody = await executeHttpCall({
291
+ request: httpReq,
292
+ httpClient: this.httpClient,
293
+ logger: this.logger,
294
+ });
295
+ resp = parseResponse(
296
+ respBody,
297
+ unmarshalListAccountIpAccessListsRequest_ResponseSchema
298
+ );
299
+ };
300
+ await executeCall(call, options);
301
+ if (resp === undefined) {
302
+ throw new Error('API call completed without a result.');
303
+ }
304
+ return resp;
305
+ }
306
+
307
+ /**
308
+ * Replaces an IP access list, specified by its ID.
309
+ *
310
+ * A list can include allow lists and block lists. See the top of this file for a description
311
+ * of how the server treats allow lists and block lists at run time. When replacing an IP
312
+ * access list:
313
+ * * For all allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values,
314
+ * where one CIDR counts as a single value. Attempts to exceed that number return error 400 with `error_code`
315
+ * value `QUOTA_EXCEEDED`.
316
+ * * If the resulting list would block the calling user's current IP, error 400 is returned with `error_code`
317
+ * value `INVALID_STATE`.
318
+ * It can take a few minutes for the changes to take effect.
319
+ */
320
+ async replaceAccountIpAccessList(
321
+ req: ReplaceAccountIpAccessListRequest,
322
+ options?: CallOptions
323
+ ): Promise<ReplaceAccountIpAccessListRequest_Response> {
324
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/ip-access-lists/${req.listId ?? ''}`;
325
+ const body = marshalRequest(
326
+ req,
327
+ marshalReplaceAccountIpAccessListRequestSchema
328
+ );
329
+ let resp: ReplaceAccountIpAccessListRequest_Response | undefined;
330
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
331
+ const headers = new Headers({'Content-Type': 'application/json'});
332
+ headers.set('User-Agent', this.userAgent);
333
+ const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
334
+ const respBody = await executeHttpCall({
335
+ request: httpReq,
336
+ httpClient: this.httpClient,
337
+ logger: this.logger,
338
+ });
339
+ resp = parseResponse(
340
+ respBody,
341
+ unmarshalReplaceAccountIpAccessListRequest_ResponseSchema
342
+ );
343
+ };
344
+ await executeCall(call, options);
345
+ if (resp === undefined) {
346
+ throw new Error('API call completed without a result.');
347
+ }
348
+ return resp;
349
+ }
350
+
351
+ /**
352
+ * Updates an existing IP access list, specified by its ID.
353
+ *
354
+ * A list can include allow lists and block lists. See the top of this file for a description
355
+ * of how the server treats allow lists and block lists at run time.
356
+ *
357
+ * When updating an IP access list:
358
+ *
359
+ * * For all allow lists and block lists combined, the API supports a maximum of 1000
360
+ * IP/CIDR values, where one CIDR counts as a single value. Attempts to exceed that number
361
+ * return error 400 with `error_code` value `QUOTA_EXCEEDED`.
362
+ * * If the updated list would block the calling user's current IP, error 400 is returned
363
+ * with `error_code` value `INVALID_STATE`.
364
+ *
365
+ * It can take a few minutes for the changes to take effect.
366
+ */
367
+ async updateAccountIpAccessList(
368
+ req: UpdateAccountIpAccessListRequest,
369
+ options?: CallOptions
370
+ ): Promise<UpdateAccountIpAccessListRequest_Response> {
371
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/ip-access-lists/${req.listId ?? ''}`;
372
+ const body = marshalRequest(
373
+ req,
374
+ marshalUpdateAccountIpAccessListRequestSchema
375
+ );
376
+ let resp: UpdateAccountIpAccessListRequest_Response | undefined;
377
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
378
+ const headers = new Headers({'Content-Type': 'application/json'});
379
+ headers.set('User-Agent', this.userAgent);
380
+ const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
381
+ const respBody = await executeHttpCall({
382
+ request: httpReq,
383
+ httpClient: this.httpClient,
384
+ logger: this.logger,
385
+ });
386
+ resp = parseResponse(
387
+ respBody,
388
+ unmarshalUpdateAccountIpAccessListRequest_ResponseSchema
389
+ );
390
+ };
391
+ await executeCall(call, options);
392
+ if (resp === undefined) {
393
+ throw new Error('API call completed without a result.');
394
+ }
395
+ return resp;
396
+ }
397
+
398
+ /**
399
+ * Creates a new network connectivity endpoint that enables private connectivity
400
+ * between your network resources and <Databricks> services.
401
+ *
402
+ * After creation, the endpoint is initially in the PENDING state. The <Databricks>
403
+ * endpoint service automatically reviews and approves the endpoint within a few
404
+ * minutes. Use the GET method to retrieve the latest endpoint state.
405
+ *
406
+ * An endpoint can be used only after it reaches the APPROVED state.
407
+ */
408
+ async createEndpoint(
409
+ req: CreateEndpointRequest,
410
+ options?: CallOptions
411
+ ): Promise<Endpoint> {
412
+ const url = `${this.host}/api/networking/v1/${req.parent ?? ''}/endpoints`;
413
+ const body = marshalRequest(req.endpoint, marshalEndpointSchema);
414
+ let resp: Endpoint | undefined;
415
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
416
+ const headers = new Headers({'Content-Type': 'application/json'});
417
+ if (this.workspaceId !== undefined) {
418
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
419
+ }
420
+ headers.set('User-Agent', this.userAgent);
421
+ const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
422
+ const respBody = await executeHttpCall({
423
+ request: httpReq,
424
+ httpClient: this.httpClient,
425
+ logger: this.logger,
426
+ });
427
+ resp = parseResponse(respBody, unmarshalEndpointSchema);
428
+ };
429
+ await executeCall(call, options);
430
+ if (resp === undefined) {
431
+ throw new Error('API call completed without a result.');
432
+ }
433
+ return resp;
434
+ }
435
+
436
+ /**
437
+ * Deletes a network endpoint. This will remove the endpoint configuration from <Databricks>.
438
+ * Depending on the endpoint type and use case, you may also need to delete corresponding network resources
439
+ * in your cloud provider account.
440
+ */
441
+ async deleteEndpoint(
442
+ req: DeleteEndpointRequest,
443
+ options?: CallOptions
444
+ ): Promise<void> {
445
+ const url = `${this.host}/api/networking/v1/${req.name ?? ''}`;
446
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
447
+ const headers = new Headers();
448
+ if (this.workspaceId !== undefined) {
449
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
450
+ }
451
+ headers.set('User-Agent', this.userAgent);
452
+ const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
453
+ await executeHttpCall({
454
+ request: httpReq,
455
+ httpClient: this.httpClient,
456
+ logger: this.logger,
457
+ });
458
+ };
459
+ await executeCall(call, options);
460
+ }
461
+
462
+ /** Gets details of a specific network endpoint. */
463
+ async getEndpoint(
464
+ req: GetEndpointRequest,
465
+ options?: CallOptions
466
+ ): Promise<Endpoint> {
467
+ const url = `${this.host}/api/networking/v1/${req.name ?? ''}`;
468
+ let resp: Endpoint | undefined;
469
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
470
+ const headers = new Headers();
471
+ if (this.workspaceId !== undefined) {
472
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
473
+ }
474
+ headers.set('User-Agent', this.userAgent);
475
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
476
+ const respBody = await executeHttpCall({
477
+ request: httpReq,
478
+ httpClient: this.httpClient,
479
+ logger: this.logger,
480
+ });
481
+ resp = parseResponse(respBody, unmarshalEndpointSchema);
482
+ };
483
+ await executeCall(call, options);
484
+ if (resp === undefined) {
485
+ throw new Error('API call completed without a result.');
486
+ }
487
+ return resp;
488
+ }
489
+
490
+ /** Lists all network connectivity endpoints for the account. */
491
+ async listEndpoints(
492
+ req: ListEndpointsRequest,
493
+ options?: CallOptions
494
+ ): Promise<ListEndpointsResponse> {
495
+ const url = `${this.host}/api/networking/v1/${req.parent ?? ''}/endpoints`;
496
+ const params = new URLSearchParams();
497
+ if (req.pageToken !== undefined) {
498
+ params.append('page_token', req.pageToken);
499
+ }
500
+ if (req.pageSize !== undefined) {
501
+ params.append('page_size', String(req.pageSize));
502
+ }
503
+ const query = params.toString();
504
+ const fullUrl = query !== '' ? `${url}?${query}` : url;
505
+ let resp: ListEndpointsResponse | undefined;
506
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
507
+ const headers = new Headers();
508
+ if (this.workspaceId !== undefined) {
509
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
510
+ }
511
+ headers.set('User-Agent', this.userAgent);
512
+ const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
513
+ const respBody = await executeHttpCall({
514
+ request: httpReq,
515
+ httpClient: this.httpClient,
516
+ logger: this.logger,
517
+ });
518
+ resp = parseResponse(respBody, unmarshalListEndpointsResponseSchema);
519
+ };
520
+ await executeCall(call, options);
521
+ if (resp === undefined) {
522
+ throw new Error('API call completed without a result.');
523
+ }
524
+ return resp;
525
+ }
526
+
527
+ async *listEndpointsIter(
528
+ req: ListEndpointsRequest,
529
+ options?: CallOptions
530
+ ): AsyncGenerator<Endpoint> {
531
+ const pageReq: ListEndpointsRequest = {...req};
532
+ for (;;) {
533
+ const resp = await this.listEndpoints(pageReq, options);
534
+ for (const item of resp.items ?? []) {
535
+ yield item;
536
+ }
537
+ if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
538
+ return;
539
+ }
540
+ pageReq.pageToken = resp.nextPageToken;
541
+ }
542
+ }
543
+
544
+ /**
545
+ * Creates an IP access list for this workspace.
546
+ *
547
+ * A list can be an allow list or a block list.
548
+ * See the top of this file for a description of how the server treats allow lists and block lists at runtime.
549
+ *
550
+ * When creating or updating an IP access list:
551
+ *
552
+ * * For all allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values,
553
+ * where one CIDR counts as a single value. Attempts to exceed that number return error 400 with `error_code` value `QUOTA_EXCEEDED`.
554
+ * * If the new list would block the calling user's current IP, error 400 is returned with `error_code` value `INVALID_STATE`.
555
+ *
556
+ * It can take a few minutes for the changes to take effect. **Note**: Your new IP access list has no effect until you enable the feature. See :method:workspaceconf/setStatus
557
+ */
558
+ async createIpAccessList(
559
+ req: CreateIpAccessList,
560
+ options?: CallOptions
561
+ ): Promise<CreateIpAccessList_Response> {
562
+ const url = `${this.host}/api/2.0/ip-access-lists`;
563
+ const body = marshalRequest(req, marshalCreateIpAccessListSchema);
564
+ let resp: CreateIpAccessList_Response | undefined;
565
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
566
+ const headers = new Headers({'Content-Type': 'application/json'});
567
+ if (this.workspaceId !== undefined) {
568
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
569
+ }
570
+ headers.set('User-Agent', this.userAgent);
571
+ const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
572
+ const respBody = await executeHttpCall({
573
+ request: httpReq,
574
+ httpClient: this.httpClient,
575
+ logger: this.logger,
576
+ });
577
+ resp = parseResponse(
578
+ respBody,
579
+ unmarshalCreateIpAccessList_ResponseSchema
580
+ );
581
+ };
582
+ await executeCall(call, options);
583
+ if (resp === undefined) {
584
+ throw new Error('API call completed without a result.');
585
+ }
586
+ return resp;
587
+ }
588
+
589
+ /** Deletes an IP access list, specified by its list ID. */
590
+ async deleteIpAccessList(
591
+ req: DeleteIpAccessList,
592
+ options?: CallOptions
593
+ ): Promise<DeleteIpAccessList_Response> {
594
+ const url = `${this.host}/api/2.0/ip-access-lists/${req.listId ?? ''}`;
595
+ let resp: DeleteIpAccessList_Response | undefined;
596
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
597
+ const headers = new Headers();
598
+ if (this.workspaceId !== undefined) {
599
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
600
+ }
601
+ headers.set('User-Agent', this.userAgent);
602
+ const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
603
+ const respBody = await executeHttpCall({
604
+ request: httpReq,
605
+ httpClient: this.httpClient,
606
+ logger: this.logger,
607
+ });
608
+ resp = parseResponse(
609
+ respBody,
610
+ unmarshalDeleteIpAccessList_ResponseSchema
611
+ );
612
+ };
613
+ await executeCall(call, options);
614
+ if (resp === undefined) {
615
+ throw new Error('API call completed without a result.');
616
+ }
617
+ return resp;
618
+ }
619
+
620
+ /** Gets an IP access list, specified by its list ID. */
621
+ async getIpAccessList(
622
+ req: GetIpAccessList,
623
+ options?: CallOptions
624
+ ): Promise<GetIpAccessList_Response> {
625
+ const url = `${this.host}/api/2.0/ip-access-lists/${req.listId ?? ''}`;
626
+ let resp: GetIpAccessList_Response | undefined;
627
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
628
+ const headers = new Headers();
629
+ if (this.workspaceId !== undefined) {
630
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
631
+ }
632
+ headers.set('User-Agent', this.userAgent);
633
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
634
+ const respBody = await executeHttpCall({
635
+ request: httpReq,
636
+ httpClient: this.httpClient,
637
+ logger: this.logger,
638
+ });
639
+ resp = parseResponse(respBody, unmarshalGetIpAccessList_ResponseSchema);
640
+ };
641
+ await executeCall(call, options);
642
+ if (resp === undefined) {
643
+ throw new Error('API call completed without a result.');
644
+ }
645
+ return resp;
646
+ }
647
+
648
+ /** Gets all IP access lists for the specified workspace. */
649
+ async listIpAccessLists(
650
+ _req: ListIpAccessLists,
651
+ options?: CallOptions
652
+ ): Promise<ListIpAccessLists_Response> {
653
+ const url = `${this.host}/api/2.0/ip-access-lists`;
654
+ let resp: ListIpAccessLists_Response | undefined;
655
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
656
+ const headers = new Headers();
657
+ if (this.workspaceId !== undefined) {
658
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
659
+ }
660
+ headers.set('User-Agent', this.userAgent);
661
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
662
+ const respBody = await executeHttpCall({
663
+ request: httpReq,
664
+ httpClient: this.httpClient,
665
+ logger: this.logger,
666
+ });
667
+ resp = parseResponse(respBody, unmarshalListIpAccessLists_ResponseSchema);
668
+ };
669
+ await executeCall(call, options);
670
+ if (resp === undefined) {
671
+ throw new Error('API call completed without a result.');
672
+ }
673
+ return resp;
674
+ }
675
+
676
+ /**
677
+ * Replaces an IP access list, specified by its ID.
678
+ *
679
+ * A list can include allow lists and block lists. See the top
680
+ * of this file for a description of how the server treats allow lists and block lists at run time. When
681
+ * replacing an IP access list:
682
+ * * For all allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values,
683
+ * where one CIDR counts as a single value. Attempts to exceed that number return error 400 with `error_code`
684
+ * value `QUOTA_EXCEEDED`.
685
+ * * If the resulting list would block the calling user's current IP, error 400 is returned with `error_code`
686
+ * value `INVALID_STATE`.
687
+ * It can take a few minutes for the changes to take effect. Note that your resulting IP access list has no
688
+ * effect until you enable the feature. See :method:workspaceconf/setStatus.
689
+ */
690
+ async replaceIpAccessList(
691
+ req: ReplaceIpAccessList,
692
+ options?: CallOptions
693
+ ): Promise<ReplaceIpAccessList_Response> {
694
+ const url = `${this.host}/api/2.0/ip-access-lists/${req.listId ?? ''}`;
695
+ const body = marshalRequest(req, marshalReplaceIpAccessListSchema);
696
+ let resp: ReplaceIpAccessList_Response | undefined;
697
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
698
+ const headers = new Headers({'Content-Type': 'application/json'});
699
+ if (this.workspaceId !== undefined) {
700
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
701
+ }
702
+ headers.set('User-Agent', this.userAgent);
703
+ const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
704
+ const respBody = await executeHttpCall({
705
+ request: httpReq,
706
+ httpClient: this.httpClient,
707
+ logger: this.logger,
708
+ });
709
+ resp = parseResponse(
710
+ respBody,
711
+ unmarshalReplaceIpAccessList_ResponseSchema
712
+ );
713
+ };
714
+ await executeCall(call, options);
715
+ if (resp === undefined) {
716
+ throw new Error('API call completed without a result.');
717
+ }
718
+ return resp;
719
+ }
720
+
721
+ /**
722
+ * Updates an existing IP access list, specified by its ID.
723
+ *
724
+ * A list can include allow lists and block lists.
725
+ * See the top of this file for a description of how the server treats allow lists and block lists at run time.
726
+ *
727
+ * When updating an IP access list:
728
+ *
729
+ * * For all allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values,
730
+ * where one CIDR counts as a single value. Attempts to exceed that number return error 400 with `error_code` value `QUOTA_EXCEEDED`.
731
+ * * If the updated list would block the calling user's current IP, error 400 is returned with `error_code` value `INVALID_STATE`.
732
+ *
733
+ * It can take a few minutes for the changes to take effect. Note that your resulting IP access list has no effect until you enable
734
+ * the feature. See :method:workspaceconf/setStatus.
735
+ */
736
+ async updateIpAccessList(
737
+ req: UpdateIpAccessList,
738
+ options?: CallOptions
739
+ ): Promise<UpdateIpAccessList_Response> {
740
+ const url = `${this.host}/api/2.0/ip-access-lists/${req.listId ?? ''}`;
741
+ const body = marshalRequest(req, marshalUpdateIpAccessListSchema);
742
+ let resp: UpdateIpAccessList_Response | undefined;
743
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
744
+ const headers = new Headers({'Content-Type': 'application/json'});
745
+ if (this.workspaceId !== undefined) {
746
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
747
+ }
748
+ headers.set('User-Agent', this.userAgent);
749
+ const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
750
+ const respBody = await executeHttpCall({
751
+ request: httpReq,
752
+ httpClient: this.httpClient,
753
+ logger: this.logger,
754
+ });
755
+ resp = parseResponse(
756
+ respBody,
757
+ unmarshalUpdateIpAccessList_ResponseSchema
758
+ );
759
+ };
760
+ await executeCall(call, options);
761
+ if (resp === undefined) {
762
+ throw new Error('API call completed without a result.');
763
+ }
764
+ return resp;
765
+ }
766
+
767
+ /**
768
+ * Creates a network connectivity configuration (NCC), which provides stable Azure service
769
+ * subnets when accessing your Azure Storage accounts. You can also use a network connectivity configuration to create
770
+ * <Databricks> managed private endpoints so that <Databricks> serverless compute resources privately access your
771
+ * resources.
772
+ *
773
+ * **IMPORTANT**: After you create the network connectivity configuration, you must assign one or more workspaces to the new network connectivity configuration.
774
+ * You can share one network connectivity configuration with multiple workspaces from the same Azure region within
775
+ * the same <Databricks> account.
776
+ * See [configure serverless secure connectivity](https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security).
777
+ */
778
+ async createNetworkConnectivityConfigPublic(
779
+ req: CreateNetworkConnectivityConfigRequest,
780
+ options?: CallOptions
781
+ ): Promise<CustomerFacingNetworkConnectivityConfig> {
782
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/network-connectivity-configs`;
783
+ const body = marshalRequest(
784
+ req.networkConnectivityConfig,
785
+ marshalCreateNetworkConnectivityConfigurationSchema
786
+ );
787
+ let resp: CustomerFacingNetworkConnectivityConfig | undefined;
788
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
789
+ const headers = new Headers({'Content-Type': 'application/json'});
790
+ headers.set('User-Agent', this.userAgent);
791
+ const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
792
+ const respBody = await executeHttpCall({
793
+ request: httpReq,
794
+ httpClient: this.httpClient,
795
+ logger: this.logger,
796
+ });
797
+ resp = parseResponse(
798
+ respBody,
799
+ unmarshalCustomerFacingNetworkConnectivityConfigSchema
800
+ );
801
+ };
802
+ await executeCall(call, options);
803
+ if (resp === undefined) {
804
+ throw new Error('API call completed without a result.');
805
+ }
806
+ return resp;
807
+ }
808
+
809
+ /** Deletes a network connectivity configuration. */
810
+ async deleteNetworkConnectivityConfigPublic(
811
+ req: DeleteNetworkConnectivityConfigRequest,
812
+ options?: CallOptions
813
+ ): Promise<void> {
814
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/network-connectivity-configs/${req.networkConnectivityConfigId ?? ''}`;
815
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
816
+ const headers = new Headers();
817
+ headers.set('User-Agent', this.userAgent);
818
+ const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
819
+ await executeHttpCall({
820
+ request: httpReq,
821
+ httpClient: this.httpClient,
822
+ logger: this.logger,
823
+ });
824
+ };
825
+ await executeCall(call, options);
826
+ }
827
+
828
+ /** Gets a network connectivity configuration. */
829
+ async getNetworkConnectivityConfigPublic(
830
+ req: GetNetworkConnectivityConfigRequest,
831
+ options?: CallOptions
832
+ ): Promise<CustomerFacingNetworkConnectivityConfig> {
833
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/network-connectivity-configs/${req.networkConnectivityConfigId ?? ''}`;
834
+ let resp: CustomerFacingNetworkConnectivityConfig | undefined;
835
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
836
+ const headers = new Headers();
837
+ headers.set('User-Agent', this.userAgent);
838
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
839
+ const respBody = await executeHttpCall({
840
+ request: httpReq,
841
+ httpClient: this.httpClient,
842
+ logger: this.logger,
843
+ });
844
+ resp = parseResponse(
845
+ respBody,
846
+ unmarshalCustomerFacingNetworkConnectivityConfigSchema
847
+ );
848
+ };
849
+ await executeCall(call, options);
850
+ if (resp === undefined) {
851
+ throw new Error('API call completed without a result.');
852
+ }
853
+ return resp;
854
+ }
855
+
856
+ /** Gets an array of network connectivity configurations. */
857
+ async listNetworkConnectivityConfigsPublic(
858
+ req: ListNetworkConnectivityConfigsRequest,
859
+ options?: CallOptions
860
+ ): Promise<ListNetworkConnectivityConfigsResponse> {
861
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/network-connectivity-configs`;
862
+ const params = new URLSearchParams();
863
+ if (req.pageToken !== undefined) {
864
+ params.append('page_token', req.pageToken);
865
+ }
866
+ const query = params.toString();
867
+ const fullUrl = query !== '' ? `${url}?${query}` : url;
868
+ let resp: ListNetworkConnectivityConfigsResponse | undefined;
869
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
870
+ const headers = new Headers();
871
+ headers.set('User-Agent', this.userAgent);
872
+ const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
873
+ const respBody = await executeHttpCall({
874
+ request: httpReq,
875
+ httpClient: this.httpClient,
876
+ logger: this.logger,
877
+ });
878
+ resp = parseResponse(
879
+ respBody,
880
+ unmarshalListNetworkConnectivityConfigsResponseSchema
881
+ );
882
+ };
883
+ await executeCall(call, options);
884
+ if (resp === undefined) {
885
+ throw new Error('API call completed without a result.');
886
+ }
887
+ return resp;
888
+ }
889
+
890
+ async *listNetworkConnectivityConfigsPublicIter(
891
+ req: ListNetworkConnectivityConfigsRequest,
892
+ options?: CallOptions
893
+ ): AsyncGenerator<CustomerFacingNetworkConnectivityConfig> {
894
+ const pageReq: ListNetworkConnectivityConfigsRequest = {...req};
895
+ for (;;) {
896
+ const resp = await this.listNetworkConnectivityConfigsPublic(
897
+ pageReq,
898
+ options
899
+ );
900
+ for (const item of resp.items ?? []) {
901
+ yield item;
902
+ }
903
+ if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
904
+ return;
905
+ }
906
+ pageReq.pageToken = resp.nextPageToken;
907
+ }
908
+ }
909
+
910
+ /**
911
+ * Create a private endpoint rule for the specified network connectivity config object.
912
+ * Once the object is created, <Databricks> asynchronously provisions a new Azure private endpoint to your
913
+ * specified Azure resource.
914
+ *
915
+ * **IMPORTANT**: You must use Azure portal or other Azure tools to approve the private endpoint to complete the
916
+ * connection. To get the information of the private endpoint created, make a `GET` request on the new private
917
+ * endpoint rule. See [serverless private link](https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security/serverless-private-link).
918
+ */
919
+ async createNccPrivateEndpointRule(
920
+ req: CreateNccPrivateEndpointRuleRequest,
921
+ options?: CallOptions
922
+ ): Promise<NccPrivateEndpointRule> {
923
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/network-connectivity-configs/${req.networkConnectivityConfigId ?? ''}/private-endpoint-rules`;
924
+ const body = marshalRequest(
925
+ req.privateEndpointRule,
926
+ marshalCreatePrivateEndpointRuleSchema
927
+ );
928
+ let resp: NccPrivateEndpointRule | undefined;
929
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
930
+ const headers = new Headers({'Content-Type': 'application/json'});
931
+ headers.set('User-Agent', this.userAgent);
932
+ const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
933
+ const respBody = await executeHttpCall({
934
+ request: httpReq,
935
+ httpClient: this.httpClient,
936
+ logger: this.logger,
937
+ });
938
+ resp = parseResponse(respBody, unmarshalNccPrivateEndpointRuleSchema);
939
+ };
940
+ await executeCall(call, options);
941
+ if (resp === undefined) {
942
+ throw new Error('API call completed without a result.');
943
+ }
944
+ return resp;
945
+ }
946
+
947
+ /**
948
+ * Initiates deleting a private endpoint rule. If the connection state is PENDING or EXPIRED,
949
+ * the private endpoint is immediately deleted. Otherwise, the private endpoint is deactivated
950
+ * and will be deleted after one day of deactivation. When a private endpoint is deactivated,
951
+ * the `deactivated` field is set to `true` and the private endpoint is not
952
+ * available to your serverless compute resources.
953
+ */
954
+ async deleteNccPrivateEndpointRule(
955
+ req: DeleteNccPrivateEndpointRuleRequest,
956
+ options?: CallOptions
957
+ ): Promise<NccPrivateEndpointRule> {
958
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/network-connectivity-configs/${req.networkConnectivityConfigId ?? ''}/private-endpoint-rules/${req.privateEndpointRuleId ?? ''}`;
959
+ let resp: NccPrivateEndpointRule | undefined;
960
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
961
+ const headers = new Headers();
962
+ headers.set('User-Agent', this.userAgent);
963
+ const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
964
+ const respBody = await executeHttpCall({
965
+ request: httpReq,
966
+ httpClient: this.httpClient,
967
+ logger: this.logger,
968
+ });
969
+ resp = parseResponse(respBody, unmarshalNccPrivateEndpointRuleSchema);
970
+ };
971
+ await executeCall(call, options);
972
+ if (resp === undefined) {
973
+ throw new Error('API call completed without a result.');
974
+ }
975
+ return resp;
976
+ }
977
+
978
+ /** Gets the private endpoint rule. */
979
+ async getNccPrivateEndpointRule(
980
+ req: GetNccPrivateEndpointRuleRequest,
981
+ options?: CallOptions
982
+ ): Promise<NccPrivateEndpointRule> {
983
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/network-connectivity-configs/${req.networkConnectivityConfigId ?? ''}/private-endpoint-rules/${req.privateEndpointRuleId ?? ''}`;
984
+ let resp: NccPrivateEndpointRule | undefined;
985
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
986
+ const headers = new Headers();
987
+ headers.set('User-Agent', this.userAgent);
988
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
989
+ const respBody = await executeHttpCall({
990
+ request: httpReq,
991
+ httpClient: this.httpClient,
992
+ logger: this.logger,
993
+ });
994
+ resp = parseResponse(respBody, unmarshalNccPrivateEndpointRuleSchema);
995
+ };
996
+ await executeCall(call, options);
997
+ if (resp === undefined) {
998
+ throw new Error('API call completed without a result.');
999
+ }
1000
+ return resp;
1001
+ }
1002
+
1003
+ /** Gets an array of private endpoint rules. */
1004
+ async listNccPrivateEndpointRules(
1005
+ req: ListNccPrivateEndpointRulesRequest,
1006
+ options?: CallOptions
1007
+ ): Promise<ListNccPrivateEndpointRulesResponse> {
1008
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/network-connectivity-configs/${req.networkConnectivityConfigId ?? ''}/private-endpoint-rules`;
1009
+ const params = new URLSearchParams();
1010
+ if (req.pageToken !== undefined) {
1011
+ params.append('page_token', req.pageToken);
1012
+ }
1013
+ const query = params.toString();
1014
+ const fullUrl = query !== '' ? `${url}?${query}` : url;
1015
+ let resp: ListNccPrivateEndpointRulesResponse | undefined;
1016
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1017
+ const headers = new Headers();
1018
+ headers.set('User-Agent', this.userAgent);
1019
+ const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
1020
+ const respBody = await executeHttpCall({
1021
+ request: httpReq,
1022
+ httpClient: this.httpClient,
1023
+ logger: this.logger,
1024
+ });
1025
+ resp = parseResponse(
1026
+ respBody,
1027
+ unmarshalListNccPrivateEndpointRulesResponseSchema
1028
+ );
1029
+ };
1030
+ await executeCall(call, options);
1031
+ if (resp === undefined) {
1032
+ throw new Error('API call completed without a result.');
1033
+ }
1034
+ return resp;
1035
+ }
1036
+
1037
+ async *listNccPrivateEndpointRulesIter(
1038
+ req: ListNccPrivateEndpointRulesRequest,
1039
+ options?: CallOptions
1040
+ ): AsyncGenerator<NccPrivateEndpointRule> {
1041
+ const pageReq: ListNccPrivateEndpointRulesRequest = {...req};
1042
+ for (;;) {
1043
+ const resp = await this.listNccPrivateEndpointRules(pageReq, options);
1044
+ for (const item of resp.items ?? []) {
1045
+ yield item;
1046
+ }
1047
+ if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
1048
+ return;
1049
+ }
1050
+ pageReq.pageToken = resp.nextPageToken;
1051
+ }
1052
+ }
1053
+
1054
+ /** Updates a private endpoint rule. Currently only a private endpoint rule to customer-managed resources is allowed to be updated. */
1055
+ async updateNccPrivateEndpointRule(
1056
+ req: UpdateNccPrivateEndpointRuleRequest,
1057
+ options?: CallOptions
1058
+ ): Promise<NccPrivateEndpointRule> {
1059
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/network-connectivity-configs/${req.networkConnectivityConfigId ?? ''}/private-endpoint-rules/${req.privateEndpointRuleId ?? ''}`;
1060
+ const params = new URLSearchParams();
1061
+ if (req.updateMask !== undefined) {
1062
+ params.append('update_mask', req.updateMask.toString());
1063
+ }
1064
+ const query = params.toString();
1065
+ const fullUrl = query !== '' ? `${url}?${query}` : url;
1066
+ const body = marshalRequest(
1067
+ req.privateEndpointRule,
1068
+ marshalUpdatePrivateEndpointRuleSchema
1069
+ );
1070
+ let resp: NccPrivateEndpointRule | undefined;
1071
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1072
+ const headers = new Headers({'Content-Type': 'application/json'});
1073
+ headers.set('User-Agent', this.userAgent);
1074
+ const httpReq = buildHttpRequest(
1075
+ 'PATCH',
1076
+ fullUrl,
1077
+ headers,
1078
+ callSignal,
1079
+ body
1080
+ );
1081
+ const respBody = await executeHttpCall({
1082
+ request: httpReq,
1083
+ httpClient: this.httpClient,
1084
+ logger: this.logger,
1085
+ });
1086
+ resp = parseResponse(respBody, unmarshalNccPrivateEndpointRuleSchema);
1087
+ };
1088
+ await executeCall(call, options);
1089
+ if (resp === undefined) {
1090
+ throw new Error('API call completed without a result.');
1091
+ }
1092
+ return resp;
1093
+ }
1094
+
1095
+ /**
1096
+ * Creates a new network policy to manage which network destinations can be accessed from the <Databricks>
1097
+ * environment.
1098
+ */
1099
+ async createNetworkPolicyRpc(
1100
+ req: CreateNetworkPolicyRequest,
1101
+ options?: CallOptions
1102
+ ): Promise<AccountNetworkPolicy> {
1103
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/network-policies`;
1104
+ const body = marshalRequest(
1105
+ req.networkPolicy,
1106
+ marshalAccountNetworkPolicySchema
1107
+ );
1108
+ let resp: AccountNetworkPolicy | undefined;
1109
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1110
+ const headers = new Headers({'Content-Type': 'application/json'});
1111
+ headers.set('User-Agent', this.userAgent);
1112
+ const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
1113
+ const respBody = await executeHttpCall({
1114
+ request: httpReq,
1115
+ httpClient: this.httpClient,
1116
+ logger: this.logger,
1117
+ });
1118
+ resp = parseResponse(respBody, unmarshalAccountNetworkPolicySchema);
1119
+ };
1120
+ await executeCall(call, options);
1121
+ if (resp === undefined) {
1122
+ throw new Error('API call completed without a result.');
1123
+ }
1124
+ return resp;
1125
+ }
1126
+
1127
+ /** Deletes a network policy. Cannot be called on 'default-policy'. */
1128
+ async deleteNetworkPolicyRpc(
1129
+ req: DeleteNetworkPolicyRequest,
1130
+ options?: CallOptions
1131
+ ): Promise<void> {
1132
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/network-policies/${req.networkPolicyId ?? ''}`;
1133
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1134
+ const headers = new Headers();
1135
+ headers.set('User-Agent', this.userAgent);
1136
+ const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
1137
+ await executeHttpCall({
1138
+ request: httpReq,
1139
+ httpClient: this.httpClient,
1140
+ logger: this.logger,
1141
+ });
1142
+ };
1143
+ await executeCall(call, options);
1144
+ }
1145
+
1146
+ /** Gets a network policy. */
1147
+ async getNetworkPolicyRpc(
1148
+ req: GetNetworkPolicyRequest,
1149
+ options?: CallOptions
1150
+ ): Promise<AccountNetworkPolicy> {
1151
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/network-policies/${req.networkPolicyId ?? ''}`;
1152
+ let resp: AccountNetworkPolicy | undefined;
1153
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1154
+ const headers = new Headers();
1155
+ headers.set('User-Agent', this.userAgent);
1156
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1157
+ const respBody = await executeHttpCall({
1158
+ request: httpReq,
1159
+ httpClient: this.httpClient,
1160
+ logger: this.logger,
1161
+ });
1162
+ resp = parseResponse(respBody, unmarshalAccountNetworkPolicySchema);
1163
+ };
1164
+ await executeCall(call, options);
1165
+ if (resp === undefined) {
1166
+ throw new Error('API call completed without a result.');
1167
+ }
1168
+ return resp;
1169
+ }
1170
+
1171
+ /** Gets an array of network policies. */
1172
+ async listNetworkPoliciesRpc(
1173
+ req: ListNetworkPoliciesRequest,
1174
+ options?: CallOptions
1175
+ ): Promise<ListNetworkPoliciesResponse> {
1176
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/network-policies`;
1177
+ const params = new URLSearchParams();
1178
+ if (req.pageToken !== undefined) {
1179
+ params.append('page_token', req.pageToken);
1180
+ }
1181
+ const query = params.toString();
1182
+ const fullUrl = query !== '' ? `${url}?${query}` : url;
1183
+ let resp: ListNetworkPoliciesResponse | undefined;
1184
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1185
+ const headers = new Headers();
1186
+ headers.set('User-Agent', this.userAgent);
1187
+ const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
1188
+ const respBody = await executeHttpCall({
1189
+ request: httpReq,
1190
+ httpClient: this.httpClient,
1191
+ logger: this.logger,
1192
+ });
1193
+ resp = parseResponse(
1194
+ respBody,
1195
+ unmarshalListNetworkPoliciesResponseSchema
1196
+ );
1197
+ };
1198
+ await executeCall(call, options);
1199
+ if (resp === undefined) {
1200
+ throw new Error('API call completed without a result.');
1201
+ }
1202
+ return resp;
1203
+ }
1204
+
1205
+ async *listNetworkPoliciesRpcIter(
1206
+ req: ListNetworkPoliciesRequest,
1207
+ options?: CallOptions
1208
+ ): AsyncGenerator<AccountNetworkPolicy> {
1209
+ const pageReq: ListNetworkPoliciesRequest = {...req};
1210
+ for (;;) {
1211
+ const resp = await this.listNetworkPoliciesRpc(pageReq, options);
1212
+ for (const item of resp.items ?? []) {
1213
+ yield item;
1214
+ }
1215
+ if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
1216
+ return;
1217
+ }
1218
+ pageReq.pageToken = resp.nextPageToken;
1219
+ }
1220
+ }
1221
+
1222
+ /** Updates a network policy. This allows you to modify the configuration of a network policy. */
1223
+ async updateNetworkPolicyRpc(
1224
+ req: UpdateNetworkPolicyRequest,
1225
+ options?: CallOptions
1226
+ ): Promise<AccountNetworkPolicy> {
1227
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/network-policies/${req.networkPolicyId ?? ''}`;
1228
+ const body = marshalRequest(
1229
+ req.networkPolicy,
1230
+ marshalAccountNetworkPolicySchema
1231
+ );
1232
+ let resp: AccountNetworkPolicy | undefined;
1233
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1234
+ const headers = new Headers({'Content-Type': 'application/json'});
1235
+ headers.set('User-Agent', this.userAgent);
1236
+ const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
1237
+ const respBody = await executeHttpCall({
1238
+ request: httpReq,
1239
+ httpClient: this.httpClient,
1240
+ logger: this.logger,
1241
+ });
1242
+ resp = parseResponse(respBody, unmarshalAccountNetworkPolicySchema);
1243
+ };
1244
+ await executeCall(call, options);
1245
+ if (resp === undefined) {
1246
+ throw new Error('API call completed without a result.');
1247
+ }
1248
+ return resp;
1249
+ }
1250
+
1251
+ /** Creates a <Databricks> network configuration that represents an VPC and its resources. The VPC will be used for new <Databricks> clusters. This requires a pre-existing VPC and subnets. */
1252
+ async createNetworkPublic(
1253
+ req: CreateNetworkRequest,
1254
+ options?: CallOptions
1255
+ ): Promise<Network> {
1256
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/networks`;
1257
+ const body = marshalRequest(req, marshalCreateNetworkRequestSchema);
1258
+ let resp: Network | undefined;
1259
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1260
+ const headers = new Headers({'Content-Type': 'application/json'});
1261
+ headers.set('User-Agent', this.userAgent);
1262
+ const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
1263
+ const respBody = await executeHttpCall({
1264
+ request: httpReq,
1265
+ httpClient: this.httpClient,
1266
+ logger: this.logger,
1267
+ });
1268
+ resp = parseResponse(respBody, unmarshalNetworkSchema);
1269
+ };
1270
+ await executeCall(call, options);
1271
+ if (resp === undefined) {
1272
+ throw new Error('API call completed without a result.');
1273
+ }
1274
+ return resp;
1275
+ }
1276
+
1277
+ /**
1278
+ * Creates a private access settings configuration, which represents
1279
+ * network access restrictions for workspace resources. Private access
1280
+ * settings configure whether workspaces can be accessed from the public
1281
+ * internet or only from private endpoints.
1282
+ */
1283
+ async createPrivateAccessSettingsPublic(
1284
+ req: CreatePrivateAccessSettingsRequest,
1285
+ options?: CallOptions
1286
+ ): Promise<CustomerFacingPrivateAccessSettings> {
1287
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/private-access-settings`;
1288
+ const body = marshalRequest(
1289
+ req,
1290
+ marshalCreatePrivateAccessSettingsRequestSchema
1291
+ );
1292
+ let resp: CustomerFacingPrivateAccessSettings | undefined;
1293
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1294
+ const headers = new Headers({'Content-Type': 'application/json'});
1295
+ headers.set('User-Agent', this.userAgent);
1296
+ const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
1297
+ const respBody = await executeHttpCall({
1298
+ request: httpReq,
1299
+ httpClient: this.httpClient,
1300
+ logger: this.logger,
1301
+ });
1302
+ resp = parseResponse(
1303
+ respBody,
1304
+ unmarshalCustomerFacingPrivateAccessSettingsSchema
1305
+ );
1306
+ };
1307
+ await executeCall(call, options);
1308
+ if (resp === undefined) {
1309
+ throw new Error('API call completed without a result.');
1310
+ }
1311
+ return resp;
1312
+ }
1313
+
1314
+ /**
1315
+ * Creates a VPC endpoint configuration, which represents a
1316
+ * [VPC endpoint](https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints.html)
1317
+ * object in AWS used to communicate privately with <Databricks> over
1318
+ * [AWS PrivateLink](https://aws.amazon.com/privatelink).
1319
+ *
1320
+ * After you create the VPC endpoint configuration, the <Databricks>
1321
+ * [endpoint service](https://docs.aws.amazon.com/vpc/latest/privatelink/privatelink-share-your-services.html)
1322
+ * automatically accepts the VPC endpoint.
1323
+ *
1324
+ * Before configuring PrivateLink, read the
1325
+ * [<Databricks> article about PrivateLink](https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html).
1326
+ */
1327
+ async createVpcEndpointPublic(
1328
+ req: CreateVpcEndpointRequest,
1329
+ options?: CallOptions
1330
+ ): Promise<CustomerFacingVpcEndpoint> {
1331
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/vpc-endpoints`;
1332
+ const body = marshalRequest(req, marshalCreateVpcEndpointRequestSchema);
1333
+ let resp: CustomerFacingVpcEndpoint | undefined;
1334
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1335
+ const headers = new Headers({'Content-Type': 'application/json'});
1336
+ headers.set('User-Agent', this.userAgent);
1337
+ const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
1338
+ const respBody = await executeHttpCall({
1339
+ request: httpReq,
1340
+ httpClient: this.httpClient,
1341
+ logger: this.logger,
1342
+ });
1343
+ resp = parseResponse(respBody, unmarshalCustomerFacingVpcEndpointSchema);
1344
+ };
1345
+ await executeCall(call, options);
1346
+ if (resp === undefined) {
1347
+ throw new Error('API call completed without a result.');
1348
+ }
1349
+ return resp;
1350
+ }
1351
+
1352
+ /**
1353
+ * Deletes a <Databricks> network configuration, which represents a cloud VPC and its resources. You cannot delete a network that is associated with a workspace.
1354
+ *
1355
+ * This operation is available only if your account is on the E2 version of the platform.
1356
+ */
1357
+ async deleteNetworkPublic(
1358
+ req: DeleteNetworkRequest,
1359
+ options?: CallOptions
1360
+ ): Promise<Network> {
1361
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/networks/${req.networkId ?? ''}`;
1362
+ let resp: Network | undefined;
1363
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1364
+ const headers = new Headers();
1365
+ headers.set('User-Agent', this.userAgent);
1366
+ const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
1367
+ const respBody = await executeHttpCall({
1368
+ request: httpReq,
1369
+ httpClient: this.httpClient,
1370
+ logger: this.logger,
1371
+ });
1372
+ resp = parseResponse(respBody, unmarshalNetworkSchema);
1373
+ };
1374
+ await executeCall(call, options);
1375
+ if (resp === undefined) {
1376
+ throw new Error('API call completed without a result.');
1377
+ }
1378
+ return resp;
1379
+ }
1380
+
1381
+ /** Deletes a <Databricks> private access settings configuration, both specified by ID. */
1382
+ async deletePrivateAccessSettingsPublic(
1383
+ req: DeletePrivateAccessSettingsRequest,
1384
+ options?: CallOptions
1385
+ ): Promise<CustomerFacingPrivateAccessSettings> {
1386
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/private-access-settings/${req.privateAccessSettingsId ?? ''}`;
1387
+ let resp: CustomerFacingPrivateAccessSettings | undefined;
1388
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1389
+ const headers = new Headers();
1390
+ headers.set('User-Agent', this.userAgent);
1391
+ const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
1392
+ const respBody = await executeHttpCall({
1393
+ request: httpReq,
1394
+ httpClient: this.httpClient,
1395
+ logger: this.logger,
1396
+ });
1397
+ resp = parseResponse(
1398
+ respBody,
1399
+ unmarshalCustomerFacingPrivateAccessSettingsSchema
1400
+ );
1401
+ };
1402
+ await executeCall(call, options);
1403
+ if (resp === undefined) {
1404
+ throw new Error('API call completed without a result.');
1405
+ }
1406
+ return resp;
1407
+ }
1408
+
1409
+ /** Deletes a Databricks VPC endpoint configuration. You cannot delete a VPC endpoint configuration that is associated with any workspace. */
1410
+ async deleteVpcEndpointPublic(
1411
+ req: DeleteVpcEndpointRequest,
1412
+ options?: CallOptions
1413
+ ): Promise<CustomerFacingVpcEndpoint> {
1414
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/vpc-endpoints/${req.vpcEndpointId ?? ''}`;
1415
+ let resp: CustomerFacingVpcEndpoint | undefined;
1416
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1417
+ const headers = new Headers();
1418
+ headers.set('User-Agent', this.userAgent);
1419
+ const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
1420
+ const respBody = await executeHttpCall({
1421
+ request: httpReq,
1422
+ httpClient: this.httpClient,
1423
+ logger: this.logger,
1424
+ });
1425
+ resp = parseResponse(respBody, unmarshalCustomerFacingVpcEndpointSchema);
1426
+ };
1427
+ await executeCall(call, options);
1428
+ if (resp === undefined) {
1429
+ throw new Error('API call completed without a result.');
1430
+ }
1431
+ return resp;
1432
+ }
1433
+
1434
+ /** Gets a <Databricks> network configuration, which represents a cloud VPC and its resources. */
1435
+ async getNetworkPublic(
1436
+ req: GetNetworkRequest,
1437
+ options?: CallOptions
1438
+ ): Promise<Network> {
1439
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/networks/${req.networkId ?? ''}`;
1440
+ let resp: Network | undefined;
1441
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1442
+ const headers = new Headers();
1443
+ headers.set('User-Agent', this.userAgent);
1444
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1445
+ const respBody = await executeHttpCall({
1446
+ request: httpReq,
1447
+ httpClient: this.httpClient,
1448
+ logger: this.logger,
1449
+ });
1450
+ resp = parseResponse(respBody, unmarshalNetworkSchema);
1451
+ };
1452
+ await executeCall(call, options);
1453
+ if (resp === undefined) {
1454
+ throw new Error('API call completed without a result.');
1455
+ }
1456
+ return resp;
1457
+ }
1458
+
1459
+ /** Gets a <Databricks> private access settings configuration, both specified by ID. */
1460
+ async getPrivateAccessSettingsPublic(
1461
+ req: GetPrivateAccessSettingsRequest,
1462
+ options?: CallOptions
1463
+ ): Promise<CustomerFacingPrivateAccessSettings> {
1464
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/private-access-settings/${req.privateAccessSettingsId ?? ''}`;
1465
+ let resp: CustomerFacingPrivateAccessSettings | undefined;
1466
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1467
+ const headers = new Headers();
1468
+ headers.set('User-Agent', this.userAgent);
1469
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1470
+ const respBody = await executeHttpCall({
1471
+ request: httpReq,
1472
+ httpClient: this.httpClient,
1473
+ logger: this.logger,
1474
+ });
1475
+ resp = parseResponse(
1476
+ respBody,
1477
+ unmarshalCustomerFacingPrivateAccessSettingsSchema
1478
+ );
1479
+ };
1480
+ await executeCall(call, options);
1481
+ if (resp === undefined) {
1482
+ throw new Error('API call completed without a result.');
1483
+ }
1484
+ return resp;
1485
+ }
1486
+
1487
+ /**
1488
+ * Gets a VPC endpoint configuration, which represents
1489
+ * a [VPC endpoint](https://docs.aws.amazon.com/vpc/latest/privatelink/concepts.html)
1490
+ * object in AWS used to communicate privately with <Databricks> over
1491
+ * [AWS PrivateLink](https://aws.amazon.com/privatelink).
1492
+ */
1493
+ async getVpcEndpointPublic(
1494
+ req: GetVpcEndpointRequest,
1495
+ options?: CallOptions
1496
+ ): Promise<CustomerFacingVpcEndpoint> {
1497
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/vpc-endpoints/${req.vpcEndpointId ?? ''}`;
1498
+ let resp: CustomerFacingVpcEndpoint | undefined;
1499
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1500
+ const headers = new Headers();
1501
+ headers.set('User-Agent', this.userAgent);
1502
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1503
+ const respBody = await executeHttpCall({
1504
+ request: httpReq,
1505
+ httpClient: this.httpClient,
1506
+ logger: this.logger,
1507
+ });
1508
+ resp = parseResponse(respBody, unmarshalCustomerFacingVpcEndpointSchema);
1509
+ };
1510
+ await executeCall(call, options);
1511
+ if (resp === undefined) {
1512
+ throw new Error('API call completed without a result.');
1513
+ }
1514
+ return resp;
1515
+ }
1516
+
1517
+ /** Lists <Databricks> network configurations for an account. */
1518
+ async listNetworkPublic(
1519
+ req: ListNetworkRequest,
1520
+ options?: CallOptions
1521
+ ): Promise<ListNetworkResponse> {
1522
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/networks`;
1523
+ let resp: ListNetworkResponse | undefined;
1524
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1525
+ const headers = new Headers();
1526
+ headers.set('User-Agent', this.userAgent);
1527
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1528
+ const respBody = await executeHttpCall({
1529
+ request: httpReq,
1530
+ httpClient: this.httpClient,
1531
+ logger: this.logger,
1532
+ });
1533
+ resp = {
1534
+ networks: parseResponse(
1535
+ respBody,
1536
+ z.array(z.lazy(() => unmarshalNetworkSchema))
1537
+ ),
1538
+ };
1539
+ };
1540
+ await executeCall(call, options);
1541
+ if (resp === undefined) {
1542
+ throw new Error('API call completed without a result.');
1543
+ }
1544
+ return resp;
1545
+ }
1546
+
1547
+ /** Lists <Databricks> private access settings for an account. */
1548
+ async listPrivateAccessSettingsPublic(
1549
+ req: ListPrivateAccessSettingsRequest,
1550
+ options?: CallOptions
1551
+ ): Promise<ListPrivateAccessSettingsResponse> {
1552
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/private-access-settings`;
1553
+ let resp: ListPrivateAccessSettingsResponse | undefined;
1554
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1555
+ const headers = new Headers();
1556
+ headers.set('User-Agent', this.userAgent);
1557
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1558
+ const respBody = await executeHttpCall({
1559
+ request: httpReq,
1560
+ httpClient: this.httpClient,
1561
+ logger: this.logger,
1562
+ });
1563
+ resp = {
1564
+ privateAccessSettings: parseResponse(
1565
+ respBody,
1566
+ z.array(
1567
+ z.lazy(() => unmarshalCustomerFacingPrivateAccessSettingsSchema)
1568
+ )
1569
+ ),
1570
+ };
1571
+ };
1572
+ await executeCall(call, options);
1573
+ if (resp === undefined) {
1574
+ throw new Error('API call completed without a result.');
1575
+ }
1576
+ return resp;
1577
+ }
1578
+
1579
+ /** Lists Databricks VPC endpoint configurations for an account. */
1580
+ async listVpcEndpointPublic(
1581
+ req: ListVpcEndpointRequest,
1582
+ options?: CallOptions
1583
+ ): Promise<ListVpcEndpointResponse> {
1584
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/vpc-endpoints`;
1585
+ let resp: ListVpcEndpointResponse | undefined;
1586
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1587
+ const headers = new Headers();
1588
+ headers.set('User-Agent', this.userAgent);
1589
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1590
+ const respBody = await executeHttpCall({
1591
+ request: httpReq,
1592
+ httpClient: this.httpClient,
1593
+ logger: this.logger,
1594
+ });
1595
+ resp = {
1596
+ vpcEndpoints: parseResponse(
1597
+ respBody,
1598
+ z.array(z.lazy(() => unmarshalCustomerFacingVpcEndpointSchema))
1599
+ ),
1600
+ };
1601
+ };
1602
+ await executeCall(call, options);
1603
+ if (resp === undefined) {
1604
+ throw new Error('API call completed without a result.');
1605
+ }
1606
+ return resp;
1607
+ }
1608
+
1609
+ /**
1610
+ * Updates an existing private access settings object, which specifies how your workspace is accessed over AWS PrivateLink. To use AWS PrivateLink, a workspace must have a private access settings object referenced by ID in the workspace's private_access_settings_id property.
1611
+ * This operation completely overwrites your existing private access settings object attached to your workspaces. All workspaces attached to the private access settings are affected by any change. If public_access_enabled, private_access_level, or allowed_vpc_endpoint_ids are updated, effects of these changes might take several minutes to propagate to the workspace API.
1612
+ * You can share one private access settings object with multiple workspaces in a single account. However, private access settings are specific to AWS regions, so only workspaces in the same AWS region can use a given private access settings object.
1613
+ * Before configuring PrivateLink, read the <Databricks> article about PrivateLink.
1614
+ */
1615
+ async updatePrivateAccessSettingsPublic(
1616
+ req: UpdatePrivateAccessSettingsRequest,
1617
+ options?: CallOptions
1618
+ ): Promise<CustomerFacingPrivateAccessSettings> {
1619
+ const url = `${this.host}/api/2.0/accounts/${req.customerFacingPrivateAccessSettings?.accountId ?? this.accountId ?? ''}/private-access-settings/${req.customerFacingPrivateAccessSettings?.privateAccessSettingsId ?? ''}`;
1620
+ const body = marshalRequest(
1621
+ req.customerFacingPrivateAccessSettings,
1622
+ marshalCustomerFacingPrivateAccessSettingsSchema
1623
+ );
1624
+ let resp: CustomerFacingPrivateAccessSettings | undefined;
1625
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1626
+ const headers = new Headers({'Content-Type': 'application/json'});
1627
+ headers.set('User-Agent', this.userAgent);
1628
+ const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
1629
+ const respBody = await executeHttpCall({
1630
+ request: httpReq,
1631
+ httpClient: this.httpClient,
1632
+ logger: this.logger,
1633
+ });
1634
+ resp = parseResponse(
1635
+ respBody,
1636
+ unmarshalCustomerFacingPrivateAccessSettingsSchema
1637
+ );
1638
+ };
1639
+ await executeCall(call, options);
1640
+ if (resp === undefined) {
1641
+ throw new Error('API call completed without a result.');
1642
+ }
1643
+ return resp;
1644
+ }
1645
+
1646
+ /**
1647
+ * Gets the network option for a workspace. Every workspace has exactly one network policy binding,
1648
+ * with 'default-policy' used if no explicit assignment exists.
1649
+ */
1650
+ async getWorkspaceNetworkOptionRpc(
1651
+ req: GetWorkspaceNetworkOptionRequest,
1652
+ options?: CallOptions
1653
+ ): Promise<WorkspaceNetworkOption> {
1654
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/workspaces/${String(req.workspaceId ?? '')}/network`;
1655
+ let resp: WorkspaceNetworkOption | undefined;
1656
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1657
+ const headers = new Headers();
1658
+ headers.set('User-Agent', this.userAgent);
1659
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1660
+ const respBody = await executeHttpCall({
1661
+ request: httpReq,
1662
+ httpClient: this.httpClient,
1663
+ logger: this.logger,
1664
+ });
1665
+ resp = parseResponse(respBody, unmarshalWorkspaceNetworkOptionSchema);
1666
+ };
1667
+ await executeCall(call, options);
1668
+ if (resp === undefined) {
1669
+ throw new Error('API call completed without a result.');
1670
+ }
1671
+ return resp;
1672
+ }
1673
+
1674
+ /**
1675
+ * Updates the network option for a workspace. This operation associates the workspace with the specified network policy.
1676
+ * To revert to the default policy, specify 'default-policy' as the network_policy_id.
1677
+ */
1678
+ async updateWorkspaceNetworkOptionRpc(
1679
+ req: UpdateWorkspaceNetworkOptionRequest,
1680
+ options?: CallOptions
1681
+ ): Promise<WorkspaceNetworkOption> {
1682
+ const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/workspaces/${String(req.workspaceId ?? '')}/network`;
1683
+ const body = marshalRequest(
1684
+ req.workspaceNetworkOption,
1685
+ marshalWorkspaceNetworkOptionSchema
1686
+ );
1687
+ let resp: WorkspaceNetworkOption | undefined;
1688
+ const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1689
+ const headers = new Headers({'Content-Type': 'application/json'});
1690
+ headers.set('User-Agent', this.userAgent);
1691
+ const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
1692
+ const respBody = await executeHttpCall({
1693
+ request: httpReq,
1694
+ httpClient: this.httpClient,
1695
+ logger: this.logger,
1696
+ });
1697
+ resp = parseResponse(respBody, unmarshalWorkspaceNetworkOptionSchema);
1698
+ };
1699
+ await executeCall(call, options);
1700
+ if (resp === undefined) {
1701
+ throw new Error('API call completed without a result.');
1702
+ }
1703
+ return resp;
1704
+ }
1705
+ }