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