@databricks/sdk-uc-entitytagassignments 0.1.0-dev.3 → 0.1.0-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- package/dist/v1/client.d.ts +3 -3
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +36 -33
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/model.d.ts +5 -4
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +7 -7
- package/dist/v1/model.js.map +1 -1
- package/dist/v1/transport.d.ts +30 -2
- package/dist/v1/transport.d.ts.map +1 -1
- package/dist/v1/transport.js +33 -16
- package/dist/v1/transport.js.map +1 -1
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +2 -1
- package/dist/v1/utils.js.map +1 -1
- package/package.json +9 -5
- package/src/v1/client.ts +0 -282
- package/src/v1/index.ts +0 -17
- package/src/v1/model.ts +0 -161
- package/src/v1/transport.ts +0 -73
- package/src/v1/utils.ts +0 -156
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @databricks/sdk-uc-entitytagassignments
|
|
2
|
+
|
|
3
|
+
> [!WARNING]
|
|
4
|
+
>
|
|
5
|
+
> ## PREVIEW - NOT FOR PRODUCTION USE
|
|
6
|
+
>
|
|
7
|
+
> **This SDK is in preview and is subject to change without notice.**
|
|
8
|
+
>
|
|
9
|
+
> - **Do NOT use in production environments**
|
|
10
|
+
> - **Breaking changes may occur at any time**
|
|
11
|
+
> - **APIs are experimental and unstable**
|
|
12
|
+
> - **Use for development and testing only**
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @databricks/sdk-uc-entitytagassignments
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import {EntityTagAssignmentsClient} from '@databricks/sdk-uc-entitytagassignments/v1';
|
|
24
|
+
|
|
25
|
+
const client = new EntityTagAssignmentsClient({});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
For a full getting-started guide, see the [root README](../../../README.md).
|
package/dist/v1/client.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import type { CallOptions } from '@databricks/sdk-options/call';
|
|
|
2
2
|
import type { ClientOptions } from '@databricks/sdk-options/client';
|
|
3
3
|
import type { CreateEntityTagAssignmentRequest, DeleteEntityTagAssignmentRequest, EntityTagAssignment, GetEntityTagAssignmentRequest, ListEntityTagAssignmentsRequest, ListEntityTagAssignmentsResponse, UpdateEntityTagAssignmentRequest } from './model';
|
|
4
4
|
export declare class EntityTagAssignmentsClient {
|
|
5
|
-
private readonly
|
|
6
|
-
private readonly workspaceId;
|
|
7
|
-
private readonly httpClient;
|
|
5
|
+
private readonly options;
|
|
8
6
|
private readonly logger;
|
|
9
7
|
private readonly userAgent;
|
|
8
|
+
private config;
|
|
10
9
|
constructor(options: ClientOptions);
|
|
10
|
+
private resolveConfig;
|
|
11
11
|
/**
|
|
12
12
|
* Creates a tag assignment for an Unity Catalog entity.
|
|
13
13
|
*
|
package/dist/v1/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAWlE,OAAO,KAAK,EACV,gCAAgC,EAChC,gCAAgC,EAChC,mBAAmB,EACnB,6BAA6B,EAC7B,+BAA+B,EAC/B,gCAAgC,EAChC,gCAAgC,EACjC,MAAM,SAAS,CAAC;AAajB,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mapp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
|
package/dist/v1/client.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { VERSION as AUTH_VERSION } from '@databricks/sdk-auth';
|
|
3
3
|
import { createDefault } from '@databricks/sdk-core/clientinfo';
|
|
4
4
|
import { NoOpLogger } from '@databricks/sdk-core/logger';
|
|
5
|
-
import {
|
|
5
|
+
import { resolveClientConfig } from './transport';
|
|
6
6
|
import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, } from './utils';
|
|
7
7
|
import pkgJson from '../../package.json' with { type: 'json' };
|
|
8
8
|
import { marshalEntityTagAssignmentSchema, unmarshalEntityTagAssignmentSchema, unmarshalListEntityTagAssignmentsResponseSchema, } from './model';
|
|
@@ -12,30 +12,28 @@ const PACKAGE_SEGMENT = {
|
|
|
12
12
|
value: pkgJson.version,
|
|
13
13
|
};
|
|
14
14
|
export class EntityTagAssignmentsClient {
|
|
15
|
-
|
|
16
|
-
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
17
|
-
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
18
|
-
// request.
|
|
19
|
-
workspaceId;
|
|
20
|
-
httpClient;
|
|
15
|
+
options;
|
|
21
16
|
logger;
|
|
22
17
|
// User-Agent header value. Composed once at construction from
|
|
23
18
|
// createDefault() merged with this package's identity and the active
|
|
24
19
|
// credential's name.
|
|
25
20
|
userAgent;
|
|
21
|
+
// Memoized configuration. The profile is resolved once, lazily, on the first
|
|
22
|
+
// request, then reused; host, workspaceId/accountId, and credentials are
|
|
23
|
+
// filled from it when not set explicitly on the options.
|
|
24
|
+
config;
|
|
26
25
|
constructor(options) {
|
|
27
|
-
|
|
28
|
-
throw new Error('Host is required.');
|
|
29
|
-
}
|
|
30
|
-
this.host = options.host.replace(/\/$/, '');
|
|
31
|
-
this.workspaceId = options.workspaceId;
|
|
26
|
+
this.options = options;
|
|
32
27
|
this.logger = options.logger ?? new NoOpLogger();
|
|
33
28
|
const info = createDefault()
|
|
34
29
|
.with(PACKAGE_SEGMENT)
|
|
35
30
|
.with({ key: 'sdk-js-auth', value: AUTH_VERSION })
|
|
36
31
|
.with({ key: 'auth', value: options.credentials?.name() ?? 'default' });
|
|
37
32
|
this.userAgent = info.toString();
|
|
38
|
-
|
|
33
|
+
}
|
|
34
|
+
resolveConfig() {
|
|
35
|
+
this.config ??= resolveClientConfig(this.options);
|
|
36
|
+
return this.config;
|
|
39
37
|
}
|
|
40
38
|
/**
|
|
41
39
|
* Creates a tag assignment for an Unity Catalog entity.
|
|
@@ -48,19 +46,20 @@ export class EntityTagAssignmentsClient {
|
|
|
48
46
|
* To add a governed tag to Unity Catalog entities, you must also have the **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage tag policy permissions](https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions).
|
|
49
47
|
*/
|
|
50
48
|
async createEntityTagAssignment(req, options) {
|
|
51
|
-
const
|
|
49
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
50
|
+
const url = `${host}/api/2.1/unity-catalog/entity-tag-assignments`;
|
|
52
51
|
const body = marshalRequest(req.tagAssignment, marshalEntityTagAssignmentSchema);
|
|
53
52
|
let resp;
|
|
54
53
|
const call = async (callSignal) => {
|
|
55
54
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
56
|
-
if (
|
|
57
|
-
headers.set('X-Databricks-Org-Id',
|
|
55
|
+
if (workspaceId !== undefined) {
|
|
56
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
58
57
|
}
|
|
59
58
|
headers.set('User-Agent', this.userAgent);
|
|
60
59
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
61
60
|
const respBody = await executeHttpCall({
|
|
62
61
|
request: httpReq,
|
|
63
|
-
httpClient
|
|
62
|
+
httpClient,
|
|
64
63
|
logger: this.logger,
|
|
65
64
|
});
|
|
66
65
|
resp = parseResponse(respBody, unmarshalEntityTagAssignmentSchema);
|
|
@@ -82,17 +81,18 @@ export class EntityTagAssignmentsClient {
|
|
|
82
81
|
* To delete a governed tag from Unity Catalog entities, you must also have the **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage tag policy permissions](https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions).
|
|
83
82
|
*/
|
|
84
83
|
async deleteEntityTagAssignment(req, options) {
|
|
85
|
-
const
|
|
84
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
85
|
+
const url = `${host}/api/2.1/unity-catalog/entity-tag-assignments/${req.entityType ?? ''}/${req.entityName ?? ''}/tags/${req.tagKey ?? ''}`;
|
|
86
86
|
const call = async (callSignal) => {
|
|
87
87
|
const headers = new Headers();
|
|
88
|
-
if (
|
|
89
|
-
headers.set('X-Databricks-Org-Id',
|
|
88
|
+
if (workspaceId !== undefined) {
|
|
89
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
90
90
|
}
|
|
91
91
|
headers.set('User-Agent', this.userAgent);
|
|
92
92
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
93
93
|
await executeHttpCall({
|
|
94
94
|
request: httpReq,
|
|
95
|
-
httpClient
|
|
95
|
+
httpClient,
|
|
96
96
|
logger: this.logger,
|
|
97
97
|
});
|
|
98
98
|
};
|
|
@@ -100,18 +100,19 @@ export class EntityTagAssignmentsClient {
|
|
|
100
100
|
}
|
|
101
101
|
/** Gets a tag assignment for an Unity Catalog entity by tag key. */
|
|
102
102
|
async getEntityTagAssignment(req, options) {
|
|
103
|
-
const
|
|
103
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
104
|
+
const url = `${host}/api/2.1/unity-catalog/entity-tag-assignments/${req.entityType ?? ''}/${req.entityName ?? ''}/tags/${req.tagKey ?? ''}`;
|
|
104
105
|
let resp;
|
|
105
106
|
const call = async (callSignal) => {
|
|
106
107
|
const headers = new Headers();
|
|
107
|
-
if (
|
|
108
|
-
headers.set('X-Databricks-Org-Id',
|
|
108
|
+
if (workspaceId !== undefined) {
|
|
109
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
109
110
|
}
|
|
110
111
|
headers.set('User-Agent', this.userAgent);
|
|
111
112
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
112
113
|
const respBody = await executeHttpCall({
|
|
113
114
|
request: httpReq,
|
|
114
|
-
httpClient
|
|
115
|
+
httpClient,
|
|
115
116
|
logger: this.logger,
|
|
116
117
|
});
|
|
117
118
|
resp = parseResponse(respBody, unmarshalEntityTagAssignmentSchema);
|
|
@@ -129,7 +130,8 @@ export class EntityTagAssignmentsClient {
|
|
|
129
130
|
* Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
|
|
130
131
|
*/
|
|
131
132
|
async listEntityTagAssignments(req, options) {
|
|
132
|
-
const
|
|
133
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
134
|
+
const url = `${host}/api/2.1/unity-catalog/entity-tag-assignments/${req.entityType ?? ''}/${req.entityName ?? ''}/tags`;
|
|
133
135
|
const params = new URLSearchParams();
|
|
134
136
|
if (req.maxResults !== undefined) {
|
|
135
137
|
params.append('max_results', String(req.maxResults));
|
|
@@ -142,14 +144,14 @@ export class EntityTagAssignmentsClient {
|
|
|
142
144
|
let resp;
|
|
143
145
|
const call = async (callSignal) => {
|
|
144
146
|
const headers = new Headers();
|
|
145
|
-
if (
|
|
146
|
-
headers.set('X-Databricks-Org-Id',
|
|
147
|
+
if (workspaceId !== undefined) {
|
|
148
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
147
149
|
}
|
|
148
150
|
headers.set('User-Agent', this.userAgent);
|
|
149
151
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
150
152
|
const respBody = await executeHttpCall({
|
|
151
153
|
request: httpReq,
|
|
152
|
-
httpClient
|
|
154
|
+
httpClient,
|
|
153
155
|
logger: this.logger,
|
|
154
156
|
});
|
|
155
157
|
resp = parseResponse(respBody, unmarshalListEntityTagAssignmentsResponseSchema);
|
|
@@ -184,7 +186,8 @@ export class EntityTagAssignmentsClient {
|
|
|
184
186
|
* To update a governed tag to Unity Catalog entities, you must also have the **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage tag policy permissions](https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions).
|
|
185
187
|
*/
|
|
186
188
|
async updateEntityTagAssignment(req, options) {
|
|
187
|
-
const
|
|
189
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
190
|
+
const url = `${host}/api/2.1/unity-catalog/entity-tag-assignments/${req.tagAssignment?.entityType ?? ''}/${req.tagAssignment?.entityName ?? ''}/tags/${req.tagAssignment?.tagKey ?? ''}`;
|
|
188
191
|
const params = new URLSearchParams();
|
|
189
192
|
if (req.updateMask !== undefined) {
|
|
190
193
|
params.append('update_mask', req.updateMask.toString());
|
|
@@ -195,14 +198,14 @@ export class EntityTagAssignmentsClient {
|
|
|
195
198
|
let resp;
|
|
196
199
|
const call = async (callSignal) => {
|
|
197
200
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
198
|
-
if (
|
|
199
|
-
headers.set('X-Databricks-Org-Id',
|
|
201
|
+
if (workspaceId !== undefined) {
|
|
202
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
200
203
|
}
|
|
201
204
|
headers.set('User-Agent', this.userAgent);
|
|
202
205
|
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
203
206
|
const respBody = await executeHttpCall({
|
|
204
207
|
request: httpReq,
|
|
205
|
-
httpClient
|
|
208
|
+
httpClient,
|
|
206
209
|
logger: this.logger,
|
|
207
210
|
});
|
|
208
211
|
resp = parseResponse(respBody, unmarshalEntityTagAssignmentSchema);
|
package/dist/v1/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,sBAAsB,CAA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,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
package/dist/v1/model.d.ts
CHANGED
|
@@ -2,12 +2,13 @@ import { Temporal } from '@js-temporal/polyfill';
|
|
|
2
2
|
import { FieldMask } from '@databricks/sdk-core/wkt';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
/** Enum representing the source type of a tag assignment */
|
|
5
|
-
export declare
|
|
5
|
+
export declare const TagAssignmentSourceType: {
|
|
6
6
|
/** Includes (but not limited to) tags manually assigned by users */
|
|
7
|
-
TAG_ASSIGNMENT_SOURCE_TYPE_UNSPECIFIED
|
|
7
|
+
readonly TAG_ASSIGNMENT_SOURCE_TYPE_UNSPECIFIED: "TAG_ASSIGNMENT_SOURCE_TYPE_UNSPECIFIED";
|
|
8
8
|
/** Automatically assigned by Data Classification */
|
|
9
|
-
TAG_ASSIGNMENT_SOURCE_TYPE_SYSTEM_DATA_CLASSIFICATION
|
|
10
|
-
}
|
|
9
|
+
readonly TAG_ASSIGNMENT_SOURCE_TYPE_SYSTEM_DATA_CLASSIFICATION: "TAG_ASSIGNMENT_SOURCE_TYPE_SYSTEM_DATA_CLASSIFICATION";
|
|
10
|
+
};
|
|
11
|
+
export type TagAssignmentSourceType = (typeof TagAssignmentSourceType)[keyof typeof TagAssignmentSourceType] | (string & {});
|
|
11
12
|
/** Request to create a new entity tag assignment */
|
|
12
13
|
export interface CreateEntityTagAssignmentRequest {
|
|
13
14
|
tagAssignment?: EntityTagAssignment | undefined;
|
package/dist/v1/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/v1/model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAC,SAAS,EAAC,MAAM,0BAA0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;AAYN,wBAAgB,4BAA4B,CAC1C,GAAG,KAAK,EAAE,MAAM,EAAE,GACjB,SAAS,CAAC,mBAAmB,CAAC,CAKhC"}
|
package/dist/v1/model.js
CHANGED
|
@@ -3,13 +3,13 @@ import { Temporal } from '@js-temporal/polyfill';
|
|
|
3
3
|
import { FieldMask } from '@databricks/sdk-core/wkt';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
/** Enum representing the source type of a tag assignment */
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.
|
|
7
|
+
export const TagAssignmentSourceType = {
|
|
8
8
|
/** Includes (but not limited to) tags manually assigned by users */
|
|
9
|
-
|
|
9
|
+
TAG_ASSIGNMENT_SOURCE_TYPE_UNSPECIFIED: 'TAG_ASSIGNMENT_SOURCE_TYPE_UNSPECIFIED',
|
|
10
10
|
/** Automatically assigned by Data Classification */
|
|
11
|
-
|
|
12
|
-
}
|
|
11
|
+
TAG_ASSIGNMENT_SOURCE_TYPE_SYSTEM_DATA_CLASSIFICATION: 'TAG_ASSIGNMENT_SOURCE_TYPE_SYSTEM_DATA_CLASSIFICATION',
|
|
12
|
+
};
|
|
13
13
|
export const unmarshalEntityTagAssignmentSchema = z
|
|
14
14
|
.object({
|
|
15
15
|
entity_name: z.string().optional(),
|
|
@@ -21,7 +21,7 @@ export const unmarshalEntityTagAssignmentSchema = z
|
|
|
21
21
|
.transform(s => Temporal.Instant.from(s))
|
|
22
22
|
.optional(),
|
|
23
23
|
updated_by: z.string().optional(),
|
|
24
|
-
source_type: z.
|
|
24
|
+
source_type: z.string().optional(),
|
|
25
25
|
})
|
|
26
26
|
.transform(d => ({
|
|
27
27
|
entityName: d.entity_name,
|
|
@@ -54,7 +54,7 @@ export const marshalEntityTagAssignmentSchema = z
|
|
|
54
54
|
.transform((d) => d.toString())
|
|
55
55
|
.optional(),
|
|
56
56
|
updatedBy: z.string().optional(),
|
|
57
|
-
sourceType: z.
|
|
57
|
+
sourceType: z.string().optional(),
|
|
58
58
|
})
|
|
59
59
|
.transform(d => ({
|
|
60
60
|
entity_name: d.entityName,
|
package/dist/v1/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/v1/model.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,4DAA4D;AAC5D,MAAM,
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/v1/model.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,4DAA4D;AAC5D,4FAA4F;AAC5F,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,oEAAoE;IACpE,sCAAsC,EACpC,wCAAwC;IAC1C,oDAAoD;IACpD,qDAAqD,EACnD,uDAAuD;CACjD,CAAC;AAyEX,MAAM,CAAC,MAAM,kCAAkC,GAC7C,CAAC;KACE,MAAM,CAAC;IACN,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,C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AAE,CAAC;SACV,GAAG,EAAE;SACL,SAAS,CAAC,CAAC,CAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;SAChD,QAAQ,EAAE;IACb,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC;KACD,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACf,WAAW,EAAE,CAAC,CAAC,UAAU;IACzB,OAAO,EAAE,CAAC,CAAC,MAAM;IACjB,SAAS,EAAE,CAAC,CAAC,QAAQ;IACrB,WAAW,EAAE,CAAC,CAAC,UAAU;IACzB,WAAW,EAAE,CAAC,CAAC,UAAU;IACzB,UAAU,EAAE,CAAC,CAAC,SAAS;IACvB,WAAW,EAAE,CAAC,CAAC,UAAU;CAC1B,CAAC,CAAC,CAAC;AAEN,MAAM,kCAAkC,GAAoB;IAC1D,UAAU,EAAE,EAAC,IAAI,EAAE,aAAa,EAAC;IACjC,UAAU,EAAE,EAAC,IAAI,EAAE,aAAa,EAAC;IACjC,UAAU,EAAE,EAAC,IAAI,EAAE,aAAa,EAAC;IACjC,MAAM,EAAE,EAAC,IAAI,EAAE,SAAS,EAAC;IACzB,QAAQ,EAAE,EAAC,IAAI,EAAE,WAAW,EAAC;IAC7B,UAAU,EAAE,EAAC,IAAI,EAAE,aAAa,EAAC;IACjC,SAAS,EAAE,EAAC,IAAI,EAAE,YAAY,EAAC;CAChC,CAAC;AAEF,MAAM,UAAU,4BAA4B,CAC1C,GAAG,KAAe;IAElB,OAAO,SAAS,CAAC,KAAK,CACpB,KAAK,EACL,kCAAkC,CACnC,CAAC;AACJ,CAAC"}
|
package/dist/v1/transport.d.ts
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
import type { HttpClient } from '@databricks/sdk-core/http';
|
|
2
2
|
import type { ClientOptions } from '@databricks/sdk-options/client';
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The configuration a client needs to issue requests, resolved from
|
|
5
|
+
* {@link ClientOptions} and a configuration profile.
|
|
6
|
+
*/
|
|
7
|
+
export interface ResolvedClientConfig {
|
|
8
|
+
/** Host with any trailing slash removed. */
|
|
9
|
+
host: string;
|
|
10
|
+
/**
|
|
11
|
+
* Default account ID for account-level paths that contain an account_id
|
|
12
|
+
* segment. A request's own accountId still wins.
|
|
13
|
+
*/
|
|
14
|
+
accountId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
17
|
+
*/
|
|
18
|
+
workspaceId?: string;
|
|
19
|
+
/** HTTP client with authentication, and any configured timeout, applied. */
|
|
20
|
+
httpClient: HttpClient;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
|
|
24
|
+
*
|
|
25
|
+
* A configuration profile is always resolved from the config file and
|
|
26
|
+
* environment variables (per options.profileOptions); it supplies host,
|
|
27
|
+
* accountId, workspaceId, and credentials wherever the caller did not set them
|
|
28
|
+
* explicitly. Explicit options always take precedence.
|
|
29
|
+
*
|
|
30
|
+
* @throws if host is neither provided nor present in the resolved profile.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveClientConfig(options: ClientOptions): Promise<ResolvedClientConfig>;
|
|
5
33
|
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/v1/transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,UAAU,EAGX,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/v1/transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,UAAU,EAGX,MAAM,2BAA2B,CAAC;AAInC,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,4EAA4E;IAC5E,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,oBAAoB,CAAC,CA4B/B"}
|
package/dist/v1/transport.js
CHANGED
|
@@ -1,24 +1,41 @@
|
|
|
1
1
|
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
2
|
import { defaultCredentials } from '@databricks/sdk-auth/credentials';
|
|
3
3
|
import { newFetchHttpClient } from '@databricks/sdk-core/http';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
import { resolve } from '@databricks/sdk-core/profiles';
|
|
5
|
+
/**
|
|
6
|
+
* Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
|
|
7
|
+
*
|
|
8
|
+
* A configuration profile is always resolved from the config file and
|
|
9
|
+
* environment variables (per options.profileOptions); it supplies host,
|
|
10
|
+
* accountId, workspaceId, and credentials wherever the caller did not set them
|
|
11
|
+
* explicitly. Explicit options always take precedence.
|
|
12
|
+
*
|
|
13
|
+
* @throws if host is neither provided nor present in the resolved profile.
|
|
14
|
+
*/
|
|
15
|
+
export async function resolveClientConfig(options) {
|
|
16
|
+
const profile = await resolve(options.profileOptions);
|
|
17
|
+
const host = options.host ?? profile.host;
|
|
18
|
+
if (host === undefined) {
|
|
19
|
+
throw new Error('Host is required.');
|
|
14
20
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
// The provided httpClient (or the default fetch client) is the base wire;
|
|
22
|
+
// authentication and the optional timeout are layered on top of it. The
|
|
23
|
+
// default credential chain reuses the profile resolved above so that the
|
|
24
|
+
// same profileOptions govern host and authentication alike.
|
|
25
|
+
const base = options.httpClient ?? newFetchHttpClient();
|
|
26
|
+
const credentials = options.credentials ?? defaultCredentials({ profile });
|
|
27
|
+
let httpClient = new AuthHttpClient(base, credentials);
|
|
28
|
+
if (options.timeout !== undefined) {
|
|
29
|
+
httpClient = new TimeoutHttpClient(httpClient, options.timeout);
|
|
20
30
|
}
|
|
21
|
-
|
|
31
|
+
const accountId = options.accountId ?? profile.accountId;
|
|
32
|
+
const workspaceId = options.workspaceId ?? profile.workspaceId;
|
|
33
|
+
return {
|
|
34
|
+
host: host.replace(/\/$/, ''),
|
|
35
|
+
httpClient,
|
|
36
|
+
...(accountId !== undefined && { accountId }),
|
|
37
|
+
...(workspaceId !== undefined && { workspaceId }),
|
|
38
|
+
};
|
|
22
39
|
}
|
|
23
40
|
/** Wraps an HttpClient and adds authentication headers to requests. */
|
|
24
41
|
class AuthHttpClient {
|
package/dist/v1/transport.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/v1/transport.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAC,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AAMpE,OAAO,EAAC,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/v1/transport.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAC,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AAMpE,OAAO,EAAC,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAC,OAAO,EAAC,MAAM,+BAA+B,CAAC;AA0BtD;;;;;;;;;GASG;A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,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAO3B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,EAC7C,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,IAAI,CAAC,CASf;AA2BD,wBAAsB,eAAe,CACnC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,UAAU,CAAC,CA2BrB;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,GACzC,WAAW,CASb;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAK1E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,MAAM,CAEvE;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,eAAe,GACtB,IAAI,CAuBN"}
|
package/dist/v1/utils.js
CHANGED
|
@@ -79,7 +79,8 @@ export function buildHttpRequest(method, url, headers, signal, body) {
|
|
|
79
79
|
}
|
|
80
80
|
export function parseResponse(body, schema) {
|
|
81
81
|
const text = new TextDecoder().decode(body);
|
|
82
|
-
|
|
82
|
+
// 204 responses return an empty body; treat as `{}`.
|
|
83
|
+
const parsed = text === '' ? {} : jsonBigint.parse(text);
|
|
83
84
|
return schema.parse(parsed);
|
|
84
85
|
}
|
|
85
86
|
export function marshalRequest(data, schema) {
|
package/dist/v1/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/v1/utils.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAC,QAAQ,EAAC,MAAM,+BAA+B,CAAC;AAQvD,OAAO,OAAO,MAAM,aAAa,CAAC;AAGlC,0EAA0E;AAC1E,6EAA6E;AAC7E,gEAAgE;AAChE,MAAM,UAAU,GAAG,OAAO,CAAC,EAAC,eAAe,EAAE,IAAI,EAAC,CAAC,CAAC;AAQpD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAA6C,EAC7C,OAAqB;IAErB,MAAM,IAAI,GAAY;QACpB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,IAAI,EAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAC,CAAC;QACjE,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,SAAS,IAAI;YACxC,WAAW,EAAE,OAAO,CAAC,WAAW;SACjC,CAAC;QACF,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,IAAI,EAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAC,CAAC;KAClE,CAAC;IACF,OAAO,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,KAAK,UAAU,OAAO,CACpB,IAAuC;IAEvC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,MAAM,MAAM,GAAiB,EA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;IACH,CAAC;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrC,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;YAC1E,kBAAkB,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;SAAM,IACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,OAAO,KAAK,KAAK,QAAQ,EACzB,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,qCAAqC,OAAO,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@databricks/sdk-uc-entitytagassignments",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"dist",
|
|
15
|
-
"src",
|
|
16
15
|
"LICENSE"
|
|
17
16
|
],
|
|
18
17
|
"scripts": {
|
|
@@ -28,10 +27,15 @@
|
|
|
28
27
|
},
|
|
29
28
|
"author": "Databricks",
|
|
30
29
|
"license": "Apache-2.0",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/databricks/sdk-js.git",
|
|
33
|
+
"directory": "packages/uc/entitytagassignments"
|
|
34
|
+
},
|
|
31
35
|
"dependencies": {
|
|
32
|
-
"@databricks/sdk-auth": ">=0.1.0-dev.
|
|
33
|
-
"@databricks/sdk-core": ">=0.1.0-dev.
|
|
34
|
-
"@databricks/sdk-options": ">=0.1.0-dev.
|
|
36
|
+
"@databricks/sdk-auth": ">=0.1.0-dev.6 <1.0.0",
|
|
37
|
+
"@databricks/sdk-core": ">=0.1.0-dev.7 <1.0.0",
|
|
38
|
+
"@databricks/sdk-options": ">=0.1.0-dev.6 <1.0.0",
|
|
35
39
|
"@js-temporal/polyfill": "^0.5.0",
|
|
36
40
|
"json-bigint": "^1.0.0",
|
|
37
41
|
"zod": "^4.3.6"
|
package/src/v1/client.ts
DELETED
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';
|
|
4
|
-
import {createDefault} from '@databricks/sdk-core/clientinfo';
|
|
5
|
-
import type {Logger} from '@databricks/sdk-core/logger';
|
|
6
|
-
import {NoOpLogger} from '@databricks/sdk-core/logger';
|
|
7
|
-
import type {CallOptions} from '@databricks/sdk-options/call';
|
|
8
|
-
import type {ClientOptions} from '@databricks/sdk-options/client';
|
|
9
|
-
import type {HttpClient} from '@databricks/sdk-core/http';
|
|
10
|
-
import {newHttpClient} from './transport';
|
|
11
|
-
import {
|
|
12
|
-
buildHttpRequest,
|
|
13
|
-
executeCall,
|
|
14
|
-
executeHttpCall,
|
|
15
|
-
marshalRequest,
|
|
16
|
-
parseResponse,
|
|
17
|
-
} from './utils';
|
|
18
|
-
import pkgJson from '../../package.json' with {type: 'json'};
|
|
19
|
-
import type {
|
|
20
|
-
CreateEntityTagAssignmentRequest,
|
|
21
|
-
DeleteEntityTagAssignmentRequest,
|
|
22
|
-
EntityTagAssignment,
|
|
23
|
-
GetEntityTagAssignmentRequest,
|
|
24
|
-
ListEntityTagAssignmentsRequest,
|
|
25
|
-
ListEntityTagAssignmentsResponse,
|
|
26
|
-
UpdateEntityTagAssignmentRequest,
|
|
27
|
-
} from './model';
|
|
28
|
-
import {
|
|
29
|
-
marshalEntityTagAssignmentSchema,
|
|
30
|
-
unmarshalEntityTagAssignmentSchema,
|
|
31
|
-
unmarshalListEntityTagAssignmentsResponseSchema,
|
|
32
|
-
} from './model';
|
|
33
|
-
|
|
34
|
-
// Package identity segment for this client to be used in the User-Agent header.
|
|
35
|
-
const PACKAGE_SEGMENT = {
|
|
36
|
-
key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
|
|
37
|
-
value: pkgJson.version,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export class EntityTagAssignmentsClient {
|
|
41
|
-
private readonly host: string;
|
|
42
|
-
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
43
|
-
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
44
|
-
// request.
|
|
45
|
-
private readonly workspaceId: string | undefined;
|
|
46
|
-
private readonly httpClient: HttpClient;
|
|
47
|
-
private readonly logger: Logger;
|
|
48
|
-
// User-Agent header value. Composed once at construction from
|
|
49
|
-
// createDefault() merged with this package's identity and the active
|
|
50
|
-
// credential's name.
|
|
51
|
-
private readonly userAgent: string;
|
|
52
|
-
|
|
53
|
-
constructor(options: ClientOptions) {
|
|
54
|
-
if (options.host === undefined) {
|
|
55
|
-
throw new Error('Host is required.');
|
|
56
|
-
}
|
|
57
|
-
this.host = options.host.replace(/\/$/, '');
|
|
58
|
-
this.workspaceId = options.workspaceId;
|
|
59
|
-
this.logger = options.logger ?? new NoOpLogger();
|
|
60
|
-
const info = createDefault()
|
|
61
|
-
.with(PACKAGE_SEGMENT)
|
|
62
|
-
.with({key: 'sdk-js-auth', value: AUTH_VERSION})
|
|
63
|
-
.with({key: 'auth', value: options.credentials?.name() ?? 'default'});
|
|
64
|
-
this.userAgent = info.toString();
|
|
65
|
-
this.httpClient = newHttpClient(options);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Creates a tag assignment for an Unity Catalog entity.
|
|
70
|
-
*
|
|
71
|
-
* To add tags to Unity Catalog entities, you must own the entity or have the following privileges:
|
|
72
|
-
* - **APPLY TAG** on the entity
|
|
73
|
-
* - **USE SCHEMA** on the entity's parent schema
|
|
74
|
-
* - **USE CATALOG** on the entity's parent catalog
|
|
75
|
-
*
|
|
76
|
-
* To add a governed tag to Unity Catalog entities, you must also have the **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage tag policy permissions](https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions).
|
|
77
|
-
*/
|
|
78
|
-
async createEntityTagAssignment(
|
|
79
|
-
req: CreateEntityTagAssignmentRequest,
|
|
80
|
-
options?: CallOptions
|
|
81
|
-
): Promise<EntityTagAssignment> {
|
|
82
|
-
const url = `${this.host}/api/2.1/unity-catalog/entity-tag-assignments`;
|
|
83
|
-
const body = marshalRequest(
|
|
84
|
-
req.tagAssignment,
|
|
85
|
-
marshalEntityTagAssignmentSchema
|
|
86
|
-
);
|
|
87
|
-
let resp: EntityTagAssignment | undefined;
|
|
88
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
89
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
90
|
-
if (this.workspaceId !== undefined) {
|
|
91
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
92
|
-
}
|
|
93
|
-
headers.set('User-Agent', this.userAgent);
|
|
94
|
-
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
95
|
-
const respBody = await executeHttpCall({
|
|
96
|
-
request: httpReq,
|
|
97
|
-
httpClient: this.httpClient,
|
|
98
|
-
logger: this.logger,
|
|
99
|
-
});
|
|
100
|
-
resp = parseResponse(respBody, unmarshalEntityTagAssignmentSchema);
|
|
101
|
-
};
|
|
102
|
-
await executeCall(call, options);
|
|
103
|
-
if (resp === undefined) {
|
|
104
|
-
throw new Error('operation completed without a result.');
|
|
105
|
-
}
|
|
106
|
-
return resp;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Deletes a tag assignment for an Unity Catalog entity by its key.
|
|
111
|
-
*
|
|
112
|
-
* To delete tags from Unity Catalog entities, you must own the entity or have the following privileges:
|
|
113
|
-
* - **APPLY TAG** on the entity
|
|
114
|
-
* - **USE_SCHEMA** on the entity's parent schema
|
|
115
|
-
* - **USE_CATALOG** on the entity's parent catalog
|
|
116
|
-
*
|
|
117
|
-
* To delete a governed tag from Unity Catalog entities, you must also have the **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage tag policy permissions](https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions).
|
|
118
|
-
*/
|
|
119
|
-
async deleteEntityTagAssignment(
|
|
120
|
-
req: DeleteEntityTagAssignmentRequest,
|
|
121
|
-
options?: CallOptions
|
|
122
|
-
): Promise<void> {
|
|
123
|
-
const url = `${this.host}/api/2.1/unity-catalog/entity-tag-assignments/${req.entityType ?? ''}/${req.entityName ?? ''}/tags/${req.tagKey ?? ''}`;
|
|
124
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
125
|
-
const headers = new Headers();
|
|
126
|
-
if (this.workspaceId !== undefined) {
|
|
127
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
128
|
-
}
|
|
129
|
-
headers.set('User-Agent', this.userAgent);
|
|
130
|
-
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
131
|
-
await executeHttpCall({
|
|
132
|
-
request: httpReq,
|
|
133
|
-
httpClient: this.httpClient,
|
|
134
|
-
logger: this.logger,
|
|
135
|
-
});
|
|
136
|
-
};
|
|
137
|
-
await executeCall(call, options);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** Gets a tag assignment for an Unity Catalog entity by tag key. */
|
|
141
|
-
async getEntityTagAssignment(
|
|
142
|
-
req: GetEntityTagAssignmentRequest,
|
|
143
|
-
options?: CallOptions
|
|
144
|
-
): Promise<EntityTagAssignment> {
|
|
145
|
-
const url = `${this.host}/api/2.1/unity-catalog/entity-tag-assignments/${req.entityType ?? ''}/${req.entityName ?? ''}/tags/${req.tagKey ?? ''}`;
|
|
146
|
-
let resp: EntityTagAssignment | undefined;
|
|
147
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
148
|
-
const headers = new Headers();
|
|
149
|
-
if (this.workspaceId !== undefined) {
|
|
150
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
151
|
-
}
|
|
152
|
-
headers.set('User-Agent', this.userAgent);
|
|
153
|
-
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
154
|
-
const respBody = await executeHttpCall({
|
|
155
|
-
request: httpReq,
|
|
156
|
-
httpClient: this.httpClient,
|
|
157
|
-
logger: this.logger,
|
|
158
|
-
});
|
|
159
|
-
resp = parseResponse(respBody, unmarshalEntityTagAssignmentSchema);
|
|
160
|
-
};
|
|
161
|
-
await executeCall(call, options);
|
|
162
|
-
if (resp === undefined) {
|
|
163
|
-
throw new Error('operation completed without a result.');
|
|
164
|
-
}
|
|
165
|
-
return resp;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* List tag assignments for an Unity Catalog entity
|
|
170
|
-
*
|
|
171
|
-
* PAGINATION BEHAVIOR: The API is by default paginated, a page may contain zero results while still providing a next_page_token.
|
|
172
|
-
* Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
|
|
173
|
-
*/
|
|
174
|
-
async listEntityTagAssignments(
|
|
175
|
-
req: ListEntityTagAssignmentsRequest,
|
|
176
|
-
options?: CallOptions
|
|
177
|
-
): Promise<ListEntityTagAssignmentsResponse> {
|
|
178
|
-
const url = `${this.host}/api/2.1/unity-catalog/entity-tag-assignments/${req.entityType ?? ''}/${req.entityName ?? ''}/tags`;
|
|
179
|
-
const params = new URLSearchParams();
|
|
180
|
-
if (req.maxResults !== undefined) {
|
|
181
|
-
params.append('max_results', String(req.maxResults));
|
|
182
|
-
}
|
|
183
|
-
if (req.pageToken !== undefined) {
|
|
184
|
-
params.append('page_token', req.pageToken);
|
|
185
|
-
}
|
|
186
|
-
const query = params.toString();
|
|
187
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
188
|
-
let resp: ListEntityTagAssignmentsResponse | undefined;
|
|
189
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
190
|
-
const headers = new Headers();
|
|
191
|
-
if (this.workspaceId !== undefined) {
|
|
192
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
193
|
-
}
|
|
194
|
-
headers.set('User-Agent', this.userAgent);
|
|
195
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
196
|
-
const respBody = await executeHttpCall({
|
|
197
|
-
request: httpReq,
|
|
198
|
-
httpClient: this.httpClient,
|
|
199
|
-
logger: this.logger,
|
|
200
|
-
});
|
|
201
|
-
resp = parseResponse(
|
|
202
|
-
respBody,
|
|
203
|
-
unmarshalListEntityTagAssignmentsResponseSchema
|
|
204
|
-
);
|
|
205
|
-
};
|
|
206
|
-
await executeCall(call, options);
|
|
207
|
-
if (resp === undefined) {
|
|
208
|
-
throw new Error('operation completed without a result.');
|
|
209
|
-
}
|
|
210
|
-
return resp;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
async *listEntityTagAssignmentsIter(
|
|
214
|
-
req: ListEntityTagAssignmentsRequest,
|
|
215
|
-
options?: CallOptions
|
|
216
|
-
): AsyncGenerator<EntityTagAssignment> {
|
|
217
|
-
const pageReq: ListEntityTagAssignmentsRequest = {...req};
|
|
218
|
-
for (;;) {
|
|
219
|
-
const resp = await this.listEntityTagAssignments(pageReq, options);
|
|
220
|
-
for (const item of resp.tagAssignments ?? []) {
|
|
221
|
-
yield item;
|
|
222
|
-
}
|
|
223
|
-
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
pageReq.pageToken = resp.nextPageToken;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Updates an existing tag assignment for an Unity Catalog entity.
|
|
232
|
-
*
|
|
233
|
-
* To update tags to Unity Catalog entities, you must own the entity or have the following privileges:
|
|
234
|
-
* - **APPLY TAG** on the entity
|
|
235
|
-
* - **USE SCHEMA** on the entity's parent schema
|
|
236
|
-
* - **USE CATALOG** on the entity's parent catalog
|
|
237
|
-
*
|
|
238
|
-
* To update a governed tag to Unity Catalog entities, you must also have the **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage tag policy permissions](https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions).
|
|
239
|
-
*/
|
|
240
|
-
async updateEntityTagAssignment(
|
|
241
|
-
req: UpdateEntityTagAssignmentRequest,
|
|
242
|
-
options?: CallOptions
|
|
243
|
-
): Promise<EntityTagAssignment> {
|
|
244
|
-
const url = `${this.host}/api/2.1/unity-catalog/entity-tag-assignments/${req.tagAssignment?.entityType ?? ''}/${req.tagAssignment?.entityName ?? ''}/tags/${req.tagAssignment?.tagKey ?? ''}`;
|
|
245
|
-
const params = new URLSearchParams();
|
|
246
|
-
if (req.updateMask !== undefined) {
|
|
247
|
-
params.append('update_mask', req.updateMask.toString());
|
|
248
|
-
}
|
|
249
|
-
const query = params.toString();
|
|
250
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
251
|
-
const body = marshalRequest(
|
|
252
|
-
req.tagAssignment,
|
|
253
|
-
marshalEntityTagAssignmentSchema
|
|
254
|
-
);
|
|
255
|
-
let resp: EntityTagAssignment | undefined;
|
|
256
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
257
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
258
|
-
if (this.workspaceId !== undefined) {
|
|
259
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
260
|
-
}
|
|
261
|
-
headers.set('User-Agent', this.userAgent);
|
|
262
|
-
const httpReq = buildHttpRequest(
|
|
263
|
-
'PATCH',
|
|
264
|
-
fullUrl,
|
|
265
|
-
headers,
|
|
266
|
-
callSignal,
|
|
267
|
-
body
|
|
268
|
-
);
|
|
269
|
-
const respBody = await executeHttpCall({
|
|
270
|
-
request: httpReq,
|
|
271
|
-
httpClient: this.httpClient,
|
|
272
|
-
logger: this.logger,
|
|
273
|
-
});
|
|
274
|
-
resp = parseResponse(respBody, unmarshalEntityTagAssignmentSchema);
|
|
275
|
-
};
|
|
276
|
-
await executeCall(call, options);
|
|
277
|
-
if (resp === undefined) {
|
|
278
|
-
throw new Error('operation completed without a result.');
|
|
279
|
-
}
|
|
280
|
-
return resp;
|
|
281
|
-
}
|
|
282
|
-
}
|
package/src/v1/index.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
export {EntityTagAssignmentsClient} from './client';
|
|
4
|
-
|
|
5
|
-
export {TagAssignmentSourceType} from './model';
|
|
6
|
-
|
|
7
|
-
export type {
|
|
8
|
-
CreateEntityTagAssignmentRequest,
|
|
9
|
-
DeleteEntityTagAssignmentRequest,
|
|
10
|
-
EntityTagAssignment,
|
|
11
|
-
GetEntityTagAssignmentRequest,
|
|
12
|
-
ListEntityTagAssignmentsRequest,
|
|
13
|
-
ListEntityTagAssignmentsResponse,
|
|
14
|
-
UpdateEntityTagAssignmentRequest,
|
|
15
|
-
} from './model';
|
|
16
|
-
|
|
17
|
-
export {entityTagAssignmentFieldMask} from './model';
|
package/src/v1/model.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import {Temporal} from '@js-temporal/polyfill';
|
|
4
|
-
import {FieldMask} from '@databricks/sdk-core/wkt';
|
|
5
|
-
import type {FieldMaskSchema} from '@databricks/sdk-core/wkt';
|
|
6
|
-
import {z} from 'zod';
|
|
7
|
-
|
|
8
|
-
/** Enum representing the source type of a tag assignment */
|
|
9
|
-
export enum TagAssignmentSourceType {
|
|
10
|
-
/** Includes (but not limited to) tags manually assigned by users */
|
|
11
|
-
TAG_ASSIGNMENT_SOURCE_TYPE_UNSPECIFIED = 'TAG_ASSIGNMENT_SOURCE_TYPE_UNSPECIFIED',
|
|
12
|
-
/** Automatically assigned by Data Classification */
|
|
13
|
-
TAG_ASSIGNMENT_SOURCE_TYPE_SYSTEM_DATA_CLASSIFICATION = 'TAG_ASSIGNMENT_SOURCE_TYPE_SYSTEM_DATA_CLASSIFICATION',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** Request to create a new entity tag assignment */
|
|
17
|
-
export interface CreateEntityTagAssignmentRequest {
|
|
18
|
-
tagAssignment?: EntityTagAssignment | undefined;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** Request to delete an entity tag assignment */
|
|
22
|
-
export interface DeleteEntityTagAssignmentRequest {
|
|
23
|
-
/** The fully qualified name of the entity to which the tag is assigned */
|
|
24
|
-
entityName?: string | undefined;
|
|
25
|
-
/** Required. The key of the tag to delete */
|
|
26
|
-
tagKey?: string | undefined;
|
|
27
|
-
/** The type of the entity to which the tag is assigned. */
|
|
28
|
-
entityType?: string | undefined;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** Represents a tag assignment to an entity */
|
|
32
|
-
export interface EntityTagAssignment {
|
|
33
|
-
/** The fully qualified name of the entity to which the tag is assigned */
|
|
34
|
-
entityName?: string | undefined;
|
|
35
|
-
/** The key of the tag */
|
|
36
|
-
tagKey?: string | undefined;
|
|
37
|
-
/** The value of the tag */
|
|
38
|
-
tagValue?: string | undefined;
|
|
39
|
-
/** The type of the entity to which the tag is assigned. */
|
|
40
|
-
entityType?: string | undefined;
|
|
41
|
-
/** The timestamp when the tag assignment was last updated */
|
|
42
|
-
updateTime?: Temporal.Instant | undefined;
|
|
43
|
-
/** The user or principal who updated the tag assignment */
|
|
44
|
-
updatedBy?: string | undefined;
|
|
45
|
-
/** The source type of the tag assignment, e.g., user-assigned or system-assigned */
|
|
46
|
-
sourceType?: TagAssignmentSourceType | undefined;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** Request to get an entity tag assignment */
|
|
50
|
-
export interface GetEntityTagAssignmentRequest {
|
|
51
|
-
/** The fully qualified name of the entity to which the tag is assigned */
|
|
52
|
-
entityName?: string | undefined;
|
|
53
|
-
/** Required. The key of the tag */
|
|
54
|
-
tagKey?: string | undefined;
|
|
55
|
-
/** The type of the entity to which the tag is assigned. */
|
|
56
|
-
entityType?: string | undefined;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** Request to list entity tag assignments */
|
|
60
|
-
export interface ListEntityTagAssignmentsRequest {
|
|
61
|
-
/** The fully qualified name of the entity to which the tag is assigned */
|
|
62
|
-
entityName?: string | undefined;
|
|
63
|
-
/** Optional. Maximum number of tag assignments to return in a single page */
|
|
64
|
-
maxResults?: number | undefined;
|
|
65
|
-
/** Optional. Pagination token to retrieve the next page of results */
|
|
66
|
-
pageToken?: string | undefined;
|
|
67
|
-
/** The type of the entity to which the tag is assigned. */
|
|
68
|
-
entityType?: string | undefined;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface ListEntityTagAssignmentsResponse {
|
|
72
|
-
/** The list of tag assignments */
|
|
73
|
-
tagAssignments?: EntityTagAssignment[] | undefined;
|
|
74
|
-
/** Optional. Pagination token for retrieving the next page of results */
|
|
75
|
-
nextPageToken?: string | undefined;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** Request to update an entity tag assignment */
|
|
79
|
-
export interface UpdateEntityTagAssignmentRequest {
|
|
80
|
-
tagAssignment?: EntityTagAssignment | undefined;
|
|
81
|
-
updateMask?: FieldMask<EntityTagAssignment> | undefined;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export const unmarshalEntityTagAssignmentSchema: z.ZodType<EntityTagAssignment> =
|
|
85
|
-
z
|
|
86
|
-
.object({
|
|
87
|
-
entity_name: z.string().optional(),
|
|
88
|
-
tag_key: z.string().optional(),
|
|
89
|
-
tag_value: z.string().optional(),
|
|
90
|
-
entity_type: z.string().optional(),
|
|
91
|
-
update_time: z
|
|
92
|
-
.string()
|
|
93
|
-
.transform(s => Temporal.Instant.from(s))
|
|
94
|
-
.optional(),
|
|
95
|
-
updated_by: z.string().optional(),
|
|
96
|
-
source_type: z.enum(TagAssignmentSourceType).optional(),
|
|
97
|
-
})
|
|
98
|
-
.transform(d => ({
|
|
99
|
-
entityName: d.entity_name,
|
|
100
|
-
tagKey: d.tag_key,
|
|
101
|
-
tagValue: d.tag_value,
|
|
102
|
-
entityType: d.entity_type,
|
|
103
|
-
updateTime: d.update_time,
|
|
104
|
-
updatedBy: d.updated_by,
|
|
105
|
-
sourceType: d.source_type,
|
|
106
|
-
}));
|
|
107
|
-
|
|
108
|
-
export const unmarshalListEntityTagAssignmentsResponseSchema: z.ZodType<ListEntityTagAssignmentsResponse> =
|
|
109
|
-
z
|
|
110
|
-
.object({
|
|
111
|
-
tag_assignments: z
|
|
112
|
-
.array(z.lazy(() => unmarshalEntityTagAssignmentSchema))
|
|
113
|
-
.optional(),
|
|
114
|
-
next_page_token: z.string().optional(),
|
|
115
|
-
})
|
|
116
|
-
.transform(d => ({
|
|
117
|
-
tagAssignments: d.tag_assignments,
|
|
118
|
-
nextPageToken: d.next_page_token,
|
|
119
|
-
}));
|
|
120
|
-
|
|
121
|
-
export const marshalEntityTagAssignmentSchema: z.ZodType = z
|
|
122
|
-
.object({
|
|
123
|
-
entityName: z.string().optional(),
|
|
124
|
-
tagKey: z.string().optional(),
|
|
125
|
-
tagValue: z.string().optional(),
|
|
126
|
-
entityType: z.string().optional(),
|
|
127
|
-
updateTime: z
|
|
128
|
-
.any()
|
|
129
|
-
.transform((d: Temporal.Instant) => d.toString())
|
|
130
|
-
.optional(),
|
|
131
|
-
updatedBy: z.string().optional(),
|
|
132
|
-
sourceType: z.enum(TagAssignmentSourceType).optional(),
|
|
133
|
-
})
|
|
134
|
-
.transform(d => ({
|
|
135
|
-
entity_name: d.entityName,
|
|
136
|
-
tag_key: d.tagKey,
|
|
137
|
-
tag_value: d.tagValue,
|
|
138
|
-
entity_type: d.entityType,
|
|
139
|
-
update_time: d.updateTime,
|
|
140
|
-
updated_by: d.updatedBy,
|
|
141
|
-
source_type: d.sourceType,
|
|
142
|
-
}));
|
|
143
|
-
|
|
144
|
-
const entityTagAssignmentFieldMaskSchema: FieldMaskSchema = {
|
|
145
|
-
entityName: {wire: 'entity_name'},
|
|
146
|
-
entityType: {wire: 'entity_type'},
|
|
147
|
-
sourceType: {wire: 'source_type'},
|
|
148
|
-
tagKey: {wire: 'tag_key'},
|
|
149
|
-
tagValue: {wire: 'tag_value'},
|
|
150
|
-
updateTime: {wire: 'update_time'},
|
|
151
|
-
updatedBy: {wire: 'updated_by'},
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
export function entityTagAssignmentFieldMask(
|
|
155
|
-
...paths: string[]
|
|
156
|
-
): FieldMask<EntityTagAssignment> {
|
|
157
|
-
return FieldMask.build<EntityTagAssignment>(
|
|
158
|
-
paths,
|
|
159
|
-
entityTagAssignmentFieldMaskSchema
|
|
160
|
-
);
|
|
161
|
-
}
|
package/src/v1/transport.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import type {Credentials} from '@databricks/sdk-auth';
|
|
4
|
-
import {defaultCredentials} from '@databricks/sdk-auth/credentials';
|
|
5
|
-
import type {
|
|
6
|
-
HttpClient,
|
|
7
|
-
HttpRequest,
|
|
8
|
-
HttpResponse,
|
|
9
|
-
} from '@databricks/sdk-core/http';
|
|
10
|
-
import {newFetchHttpClient} from '@databricks/sdk-core/http';
|
|
11
|
-
import type {ClientOptions} from '@databricks/sdk-options/client';
|
|
12
|
-
|
|
13
|
-
/** Creates a new HTTP client with the given options. */
|
|
14
|
-
export function newHttpClient(options?: ClientOptions): HttpClient {
|
|
15
|
-
const opts = options ?? {};
|
|
16
|
-
|
|
17
|
-
// If an HTTP client is provided, use it as-is. Throw if other options are
|
|
18
|
-
// also set, since they would be silently ignored.
|
|
19
|
-
if (opts.httpClient !== undefined) {
|
|
20
|
-
if (opts.credentials !== undefined || opts.timeout !== undefined) {
|
|
21
|
-
throw new Error(
|
|
22
|
-
'httpClient cannot be combined with credentials or timeout'
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
return opts.httpClient;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const credentials = opts.credentials ?? defaultCredentials();
|
|
29
|
-
|
|
30
|
-
const base = newFetchHttpClient();
|
|
31
|
-
let client: HttpClient = new AuthHttpClient(base, credentials);
|
|
32
|
-
|
|
33
|
-
if (opts.timeout !== undefined) {
|
|
34
|
-
client = new TimeoutHttpClient(client, opts.timeout);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return client;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** Wraps an HttpClient and adds authentication headers to requests. */
|
|
41
|
-
class AuthHttpClient implements HttpClient {
|
|
42
|
-
constructor(
|
|
43
|
-
private readonly base: HttpClient,
|
|
44
|
-
private readonly credentials: Credentials
|
|
45
|
-
) {}
|
|
46
|
-
|
|
47
|
-
async send(request: HttpRequest): Promise<HttpResponse> {
|
|
48
|
-
const authHeaders = await this.credentials.authHeaders();
|
|
49
|
-
// Do not modify the original request.
|
|
50
|
-
const headers = new Headers(request.headers);
|
|
51
|
-
for (const h of authHeaders) {
|
|
52
|
-
headers.set(h.key, h.value);
|
|
53
|
-
}
|
|
54
|
-
return this.base.send({...request, headers});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** Wraps an HttpClient and applies a default timeout to requests. */
|
|
59
|
-
class TimeoutHttpClient implements HttpClient {
|
|
60
|
-
constructor(
|
|
61
|
-
private readonly base: HttpClient,
|
|
62
|
-
private readonly timeout: number
|
|
63
|
-
) {}
|
|
64
|
-
|
|
65
|
-
async send(request: HttpRequest): Promise<HttpResponse> {
|
|
66
|
-
const timeoutSignal = AbortSignal.timeout(this.timeout);
|
|
67
|
-
const signal =
|
|
68
|
-
request.signal !== undefined
|
|
69
|
-
? AbortSignal.any([request.signal, timeoutSignal])
|
|
70
|
-
: timeoutSignal;
|
|
71
|
-
return this.base.send({...request, signal});
|
|
72
|
-
}
|
|
73
|
-
}
|
package/src/v1/utils.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import type {Options} from '@databricks/sdk-core/ops';
|
|
4
|
-
import {execute} from '@databricks/sdk-core/ops';
|
|
5
|
-
import {ApiError} from '@databricks/sdk-core/apierror';
|
|
6
|
-
import type {
|
|
7
|
-
HttpClient,
|
|
8
|
-
HttpRequest,
|
|
9
|
-
HttpResponse,
|
|
10
|
-
} from '@databricks/sdk-core/http';
|
|
11
|
-
import type {Logger} from '@databricks/sdk-core/logger';
|
|
12
|
-
import type {CallOptions} from '@databricks/sdk-options/call';
|
|
13
|
-
import JSONBig from 'json-bigint';
|
|
14
|
-
import type {z} from 'zod';
|
|
15
|
-
|
|
16
|
-
// JSON codec that preserves int64 precision. On the way in, large integer
|
|
17
|
-
// literals come back as bigint instead of being rounded to JS Number. On the
|
|
18
|
-
// way out, bigint values are emitted as raw JSON number digits.
|
|
19
|
-
const jsonBigint = JSONBig({useNativeBigInt: true});
|
|
20
|
-
|
|
21
|
-
export interface HttpCallOptions {
|
|
22
|
-
readonly request: HttpRequest;
|
|
23
|
-
readonly httpClient: HttpClient;
|
|
24
|
-
readonly logger: Logger;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Translates public CallOptions to the internal Options shape accepted by
|
|
29
|
-
* execute(). Even though the shapes match today, this isolates the public
|
|
30
|
-
* API from the executor's internal type so they can diverge.
|
|
31
|
-
*/
|
|
32
|
-
export async function executeCall(
|
|
33
|
-
call: (signal?: AbortSignal) => Promise<void>,
|
|
34
|
-
options?: CallOptions
|
|
35
|
-
): Promise<void> {
|
|
36
|
-
const opts: Options = {
|
|
37
|
-
...(options?.retrier !== undefined && {retrier: options.retrier}),
|
|
38
|
-
...(options?.rateLimiter !== undefined && {
|
|
39
|
-
rateLimiter: options.rateLimiter,
|
|
40
|
-
}),
|
|
41
|
-
...(options?.timeout !== undefined && {timeout: options.timeout}),
|
|
42
|
-
};
|
|
43
|
-
return execute(options?.signal, call, opts);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async function readAll(
|
|
47
|
-
body: ReadableStream<Uint8Array> | null
|
|
48
|
-
): Promise<Uint8Array> {
|
|
49
|
-
if (body === null) {
|
|
50
|
-
return new Uint8Array(0);
|
|
51
|
-
}
|
|
52
|
-
const reader = body.getReader();
|
|
53
|
-
const chunks: Uint8Array[] = [];
|
|
54
|
-
for (;;) {
|
|
55
|
-
const {done, value} = await reader.read();
|
|
56
|
-
if (done) {
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
chunks.push(value);
|
|
60
|
-
}
|
|
61
|
-
const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
|
|
62
|
-
const result = new Uint8Array(totalLength);
|
|
63
|
-
let offset = 0;
|
|
64
|
-
for (const chunk of chunks) {
|
|
65
|
-
result.set(chunk, offset);
|
|
66
|
-
offset += chunk.length;
|
|
67
|
-
}
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export async function executeHttpCall(
|
|
72
|
-
opts: HttpCallOptions
|
|
73
|
-
): Promise<Uint8Array> {
|
|
74
|
-
opts.logger.debug('HTTP request', {
|
|
75
|
-
method: opts.request.method,
|
|
76
|
-
url: opts.request.url,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
let resp: HttpResponse;
|
|
80
|
-
try {
|
|
81
|
-
resp = await opts.httpClient.send(opts.request);
|
|
82
|
-
} catch (e: unknown) {
|
|
83
|
-
opts.logger.debug('HTTP request failed');
|
|
84
|
-
throw e;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const body = await readAll(resp.body);
|
|
88
|
-
|
|
89
|
-
opts.logger.debug('HTTP response', {
|
|
90
|
-
statusCode: resp.statusCode,
|
|
91
|
-
body: new TextDecoder().decode(body),
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
const apiErr = ApiError.fromHttpError(resp.statusCode, resp.headers, body);
|
|
95
|
-
if (apiErr !== undefined) {
|
|
96
|
-
throw apiErr;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return body;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export function buildHttpRequest(
|
|
103
|
-
method: string,
|
|
104
|
-
url: string,
|
|
105
|
-
headers: Headers,
|
|
106
|
-
signal?: AbortSignal,
|
|
107
|
-
body?: string | ReadableStream<Uint8Array>
|
|
108
|
-
): HttpRequest {
|
|
109
|
-
const req: HttpRequest = {url, method, headers};
|
|
110
|
-
if (body !== undefined) {
|
|
111
|
-
req.body = body;
|
|
112
|
-
}
|
|
113
|
-
if (signal !== undefined) {
|
|
114
|
-
req.signal = signal;
|
|
115
|
-
}
|
|
116
|
-
return req;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T {
|
|
120
|
-
const text = new TextDecoder().decode(body);
|
|
121
|
-
const parsed: unknown = jsonBigint.parse(text);
|
|
122
|
-
return schema.parse(parsed);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export function marshalRequest(data: unknown, schema: z.ZodType): string {
|
|
126
|
-
return jsonBigint.stringify(schema.parse(data));
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export function flattenQueryParams(
|
|
130
|
-
prefix: string,
|
|
131
|
-
value: unknown,
|
|
132
|
-
params: URLSearchParams
|
|
133
|
-
): void {
|
|
134
|
-
if (value === null || value === undefined) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (Array.isArray(value)) {
|
|
138
|
-
// arrays of objects are not yet supported
|
|
139
|
-
for (const item of value) {
|
|
140
|
-
params.append(prefix, String(item));
|
|
141
|
-
}
|
|
142
|
-
} else if (typeof value === 'object') {
|
|
143
|
-
for (const [key, val] of Object.entries(value as Record<string, unknown>)) {
|
|
144
|
-
flattenQueryParams(`${prefix}.${key}`, val, params);
|
|
145
|
-
}
|
|
146
|
-
} else if (
|
|
147
|
-
typeof value === 'string' ||
|
|
148
|
-
typeof value === 'number' ||
|
|
149
|
-
typeof value === 'boolean' ||
|
|
150
|
-
typeof value === 'bigint'
|
|
151
|
-
) {
|
|
152
|
-
params.append(prefix, String(value));
|
|
153
|
-
} else {
|
|
154
|
-
throw new Error(`Unsupported query parameter type: ${typeof value}`);
|
|
155
|
-
}
|
|
156
|
-
}
|