@databricks/sdk-uc-secrets 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/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 -293
- package/src/v1/index.ts +0 -15
- package/src/v1/model.ts +0 -296
- 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-secrets
|
|
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-secrets
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import {SecretsClient} from '@databricks/sdk-uc-secrets/v1';
|
|
24
|
+
|
|
25
|
+
const client = new SecretsClient({});
|
|
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 { CreateSecretRequest, DeleteSecretRequest, GetSecretRequest, ListSecretsRequest, ListSecretsResponse, Secret, UpdateSecretRequest } from './model';
|
|
4
4
|
export declare class SecretsClient {
|
|
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 new secret in Unity Catalog.
|
|
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,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,EACN,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAajB,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,
|
|
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,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,EACN,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAajB,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAIhC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAInC,OAAO,CAAC,MAAM,CAA4C;gBAE9C,OAAO,EAAE,aAAa;IAUlC,OAAO,CAAC,aAAa;IAKrB;;;;;;;;OAQG;IACG,YAAY,CAChB,GAAG,EAAE,mBAAmB,EACxB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,MAAM,CAAC;IA0BlB;;;;OAIG;IACG,YAAY,CAChB,GAAG,EAAE,mBAAmB,EACxB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,IAAI,CAAC;IAmBhB;;;;;;;;OAQG;IACG,SAAS,CACb,GAAG,EAAE,gBAAgB,EACrB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,MAAM,CAAC;IA+BlB;;;;;;;;;OASG;IACG,WAAW,CACf,GAAG,EAAE,kBAAkB,EACvB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,mBAAmB,CAAC;IA2CxB,eAAe,CACpB,GAAG,EAAE,kBAAkB,EACvB,OAAO,CAAC,EAAE,WAAW,GACpB,cAAc,CAAC,MAAM,CAAC;IAczB;;;;;;;;OAQG;IACG,YAAY,CAChB,GAAG,EAAE,mBAAmB,EACxB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,MAAM,CAAC;CAqCnB"}
|
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 { marshalSecretSchema, unmarshalListSecretsResponseSchema, unmarshalSecretSchema, } from './model';
|
|
@@ -12,30 +12,28 @@ const PACKAGE_SEGMENT = {
|
|
|
12
12
|
value: pkgJson.version,
|
|
13
13
|
};
|
|
14
14
|
export class SecretsClient {
|
|
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 new secret in Unity Catalog.
|
|
@@ -47,19 +45,20 @@ export class SecretsClient {
|
|
|
47
45
|
* contains the sensitive data to be securely stored.
|
|
48
46
|
*/
|
|
49
47
|
async createSecret(req, options) {
|
|
50
|
-
const
|
|
48
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
49
|
+
const url = `${host}/api/2.1/unity-catalog/secrets`;
|
|
51
50
|
const body = marshalRequest(req.secret, marshalSecretSchema);
|
|
52
51
|
let resp;
|
|
53
52
|
const call = async (callSignal) => {
|
|
54
53
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
55
|
-
if (
|
|
56
|
-
headers.set('X-Databricks-Org-Id',
|
|
54
|
+
if (workspaceId !== undefined) {
|
|
55
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
57
56
|
}
|
|
58
57
|
headers.set('User-Agent', this.userAgent);
|
|
59
58
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
60
59
|
const respBody = await executeHttpCall({
|
|
61
60
|
request: httpReq,
|
|
62
|
-
httpClient
|
|
61
|
+
httpClient,
|
|
63
62
|
logger: this.logger,
|
|
64
63
|
});
|
|
65
64
|
resp = parseResponse(respBody, unmarshalSecretSchema);
|
|
@@ -76,17 +75,18 @@ export class SecretsClient {
|
|
|
76
75
|
* You must be the owner of the secret or a metastore admin.
|
|
77
76
|
*/
|
|
78
77
|
async deleteSecret(req, options) {
|
|
79
|
-
const
|
|
78
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
79
|
+
const url = `${host}/api/2.1/unity-catalog/secrets/${req.fullName ?? ''}`;
|
|
80
80
|
const call = async (callSignal) => {
|
|
81
81
|
const headers = new Headers();
|
|
82
|
-
if (
|
|
83
|
-
headers.set('X-Databricks-Org-Id',
|
|
82
|
+
if (workspaceId !== undefined) {
|
|
83
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
84
84
|
}
|
|
85
85
|
headers.set('User-Agent', this.userAgent);
|
|
86
86
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
87
87
|
await executeHttpCall({
|
|
88
88
|
request: httpReq,
|
|
89
|
-
httpClient
|
|
89
|
+
httpClient,
|
|
90
90
|
logger: this.logger,
|
|
91
91
|
});
|
|
92
92
|
};
|
|
@@ -102,7 +102,8 @@ export class SecretsClient {
|
|
|
102
102
|
* **READ_SECRET** privilege and set **include_value** to true in the request.
|
|
103
103
|
*/
|
|
104
104
|
async getSecret(req, options) {
|
|
105
|
-
const
|
|
105
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
106
|
+
const url = `${host}/api/2.1/unity-catalog/secrets/${req.fullName ?? ''}`;
|
|
106
107
|
const params = new URLSearchParams();
|
|
107
108
|
if (req.includeBrowse !== undefined) {
|
|
108
109
|
params.append('include_browse', String(req.includeBrowse));
|
|
@@ -112,14 +113,14 @@ export class SecretsClient {
|
|
|
112
113
|
let resp;
|
|
113
114
|
const call = async (callSignal) => {
|
|
114
115
|
const headers = new Headers();
|
|
115
|
-
if (
|
|
116
|
-
headers.set('X-Databricks-Org-Id',
|
|
116
|
+
if (workspaceId !== undefined) {
|
|
117
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
117
118
|
}
|
|
118
119
|
headers.set('User-Agent', this.userAgent);
|
|
119
120
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
120
121
|
const respBody = await executeHttpCall({
|
|
121
122
|
request: httpReq,
|
|
122
|
-
httpClient
|
|
123
|
+
httpClient,
|
|
123
124
|
logger: this.logger,
|
|
124
125
|
});
|
|
125
126
|
resp = parseResponse(respBody, unmarshalSecretSchema);
|
|
@@ -141,7 +142,8 @@ export class SecretsClient {
|
|
|
141
142
|
* to retrieve subsequent pages.
|
|
142
143
|
*/
|
|
143
144
|
async listSecrets(req, options) {
|
|
144
|
-
const
|
|
145
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
146
|
+
const url = `${host}/api/2.1/unity-catalog/secrets`;
|
|
145
147
|
const params = new URLSearchParams();
|
|
146
148
|
if (req.catalogName !== undefined) {
|
|
147
149
|
params.append('catalog_name', req.catalogName);
|
|
@@ -163,14 +165,14 @@ export class SecretsClient {
|
|
|
163
165
|
let resp;
|
|
164
166
|
const call = async (callSignal) => {
|
|
165
167
|
const headers = new Headers();
|
|
166
|
-
if (
|
|
167
|
-
headers.set('X-Databricks-Org-Id',
|
|
168
|
+
if (workspaceId !== undefined) {
|
|
169
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
168
170
|
}
|
|
169
171
|
headers.set('User-Agent', this.userAgent);
|
|
170
172
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
171
173
|
const respBody = await executeHttpCall({
|
|
172
174
|
request: httpReq,
|
|
173
|
-
httpClient
|
|
175
|
+
httpClient,
|
|
174
176
|
logger: this.logger,
|
|
175
177
|
});
|
|
176
178
|
resp = parseResponse(respBody, unmarshalListSecretsResponseSchema);
|
|
@@ -204,7 +206,8 @@ export class SecretsClient {
|
|
|
204
206
|
* include **value**, **comment**, **owner**, and **expire_time**.
|
|
205
207
|
*/
|
|
206
208
|
async updateSecret(req, options) {
|
|
207
|
-
const
|
|
209
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
210
|
+
const url = `${host}/api/2.1/unity-catalog/secrets/${req.fullName ?? ''}`;
|
|
208
211
|
const params = new URLSearchParams();
|
|
209
212
|
if (req.updateMask !== undefined) {
|
|
210
213
|
params.append('update_mask', req.updateMask.toString());
|
|
@@ -215,14 +218,14 @@ export class SecretsClient {
|
|
|
215
218
|
let resp;
|
|
216
219
|
const call = async (callSignal) => {
|
|
217
220
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
218
|
-
if (
|
|
219
|
-
headers.set('X-Databricks-Org-Id',
|
|
221
|
+
if (workspaceId !== undefined) {
|
|
222
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
220
223
|
}
|
|
221
224
|
headers.set('User-Agent', this.userAgent);
|
|
222
225
|
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
223
226
|
const respBody = await executeHttpCall({
|
|
224
227
|
request: httpReq,
|
|
225
|
-
httpClient
|
|
228
|
+
httpClient,
|
|
226
229
|
logger: this.logger,
|
|
227
230
|
});
|
|
228
231
|
resp = parseResponse(respBody, unmarshalSecretSchema);
|
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,CAAC;AAC7D,OAAO,EAAC,aAAa,EAAC,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAIvD,OAAO,EAAC,
|
|
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,CAAC;AAC7D,OAAO,EAAC,aAAa,EAAC,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAIvD,OAAO,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,cAAc,EACd,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,OAAO,MAAM,oBAAoB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AAU7D,OAAO,EACL,mBAAmB,EACnB,kCAAkC,EAClC,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB,gFAAgF;AAChF,MAAM,eAAe,GAAG;IACtB,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,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K,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QACvD,MAAM,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;QAC7D,IAAI,IAAwB,CAAC;QAC7B,MAAM,IAAI,GAAG,KAAK,EAAE,UAAwB,EAAiB,EAAE;YAC7D,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAC,cAAc,EAAE,kBAAkB,EAAC,CAAC,CAAC;YAClE,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC9B,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;YAClD,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAC1C,MAAM,OAAO,GAAG,gBAAgB,CAC9B,OAAO,EACP,OAAO,EACP,OAAO,EACP,UAAU,EACV,IAAI,CACL,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC;gBACrC,OAAO,EAAE,OAAO;gBAChB,UAAU;gBACV,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB,CAAC,CAAC;YACH,IAAI,GAAG,aAAa,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;QACxD,CAAC,CAAC;QACF,MAAM,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACjC,IAAI,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/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;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC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3B,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,EAAE,CAAC;IAChC,SAAS,CAAC;QACR,MAAM,EA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,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-secrets",
|
|
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/secrets"
|
|
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,293 +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
|
-
CreateSecretRequest,
|
|
21
|
-
DeleteSecretRequest,
|
|
22
|
-
GetSecretRequest,
|
|
23
|
-
ListSecretsRequest,
|
|
24
|
-
ListSecretsResponse,
|
|
25
|
-
Secret,
|
|
26
|
-
UpdateSecretRequest,
|
|
27
|
-
} from './model';
|
|
28
|
-
import {
|
|
29
|
-
marshalSecretSchema,
|
|
30
|
-
unmarshalListSecretsResponseSchema,
|
|
31
|
-
unmarshalSecretSchema,
|
|
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 SecretsClient {
|
|
41
|
-
private readonly host: string;
|
|
42
|
-
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
43
|
-
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
44
|
-
// request.
|
|
45
|
-
private readonly workspaceId: string | undefined;
|
|
46
|
-
private readonly httpClient: HttpClient;
|
|
47
|
-
private readonly logger: Logger;
|
|
48
|
-
// User-Agent header value. Composed once at construction from
|
|
49
|
-
// createDefault() merged with this package's identity and the active
|
|
50
|
-
// credential's name.
|
|
51
|
-
private readonly userAgent: string;
|
|
52
|
-
|
|
53
|
-
constructor(options: ClientOptions) {
|
|
54
|
-
if (options.host === undefined) {
|
|
55
|
-
throw new Error('Host is required.');
|
|
56
|
-
}
|
|
57
|
-
this.host = options.host.replace(/\/$/, '');
|
|
58
|
-
this.workspaceId = options.workspaceId;
|
|
59
|
-
this.logger = options.logger ?? new NoOpLogger();
|
|
60
|
-
const info = createDefault()
|
|
61
|
-
.with(PACKAGE_SEGMENT)
|
|
62
|
-
.with({key: 'sdk-js-auth', value: AUTH_VERSION})
|
|
63
|
-
.with({key: 'auth', value: options.credentials?.name() ?? 'default'});
|
|
64
|
-
this.userAgent = info.toString();
|
|
65
|
-
this.httpClient = newHttpClient(options);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Creates a new secret in Unity Catalog.
|
|
70
|
-
*
|
|
71
|
-
* You must be the owner of the parent schema or have the **CREATE_SECRET** and **USE SCHEMA**
|
|
72
|
-
* privileges on the parent schema and **USE CATALOG** on the parent catalog.
|
|
73
|
-
*
|
|
74
|
-
* The secret is stored in the specified catalog and schema, and the **value** field
|
|
75
|
-
* contains the sensitive data to be securely stored.
|
|
76
|
-
*/
|
|
77
|
-
async createSecret(
|
|
78
|
-
req: CreateSecretRequest,
|
|
79
|
-
options?: CallOptions
|
|
80
|
-
): Promise<Secret> {
|
|
81
|
-
const url = `${this.host}/api/2.1/unity-catalog/secrets`;
|
|
82
|
-
const body = marshalRequest(req.secret, marshalSecretSchema);
|
|
83
|
-
let resp: Secret | undefined;
|
|
84
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
85
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
86
|
-
if (this.workspaceId !== undefined) {
|
|
87
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
88
|
-
}
|
|
89
|
-
headers.set('User-Agent', this.userAgent);
|
|
90
|
-
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
91
|
-
const respBody = await executeHttpCall({
|
|
92
|
-
request: httpReq,
|
|
93
|
-
httpClient: this.httpClient,
|
|
94
|
-
logger: this.logger,
|
|
95
|
-
});
|
|
96
|
-
resp = parseResponse(respBody, unmarshalSecretSchema);
|
|
97
|
-
};
|
|
98
|
-
await executeCall(call, options);
|
|
99
|
-
if (resp === undefined) {
|
|
100
|
-
throw new Error('operation completed without a result.');
|
|
101
|
-
}
|
|
102
|
-
return resp;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Deletes a secret by its three-level (fully qualified) name.
|
|
107
|
-
*
|
|
108
|
-
* You must be the owner of the secret or a metastore admin.
|
|
109
|
-
*/
|
|
110
|
-
async deleteSecret(
|
|
111
|
-
req: DeleteSecretRequest,
|
|
112
|
-
options?: CallOptions
|
|
113
|
-
): Promise<void> {
|
|
114
|
-
const url = `${this.host}/api/2.1/unity-catalog/secrets/${req.fullName ?? ''}`;
|
|
115
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
116
|
-
const headers = new Headers();
|
|
117
|
-
if (this.workspaceId !== undefined) {
|
|
118
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
119
|
-
}
|
|
120
|
-
headers.set('User-Agent', this.userAgent);
|
|
121
|
-
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
122
|
-
await executeHttpCall({
|
|
123
|
-
request: httpReq,
|
|
124
|
-
httpClient: this.httpClient,
|
|
125
|
-
logger: this.logger,
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
await executeCall(call, options);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Gets a secret by its three-level (fully qualified) name.
|
|
133
|
-
*
|
|
134
|
-
* You must be a metastore admin, the owner of the secret, or have the **MANAGE**
|
|
135
|
-
* privilege on the secret.
|
|
136
|
-
*
|
|
137
|
-
* The secret value isn't returned by default. To retrieve it, you must also have the
|
|
138
|
-
* **READ_SECRET** privilege and set **include_value** to true in the request.
|
|
139
|
-
*/
|
|
140
|
-
async getSecret(
|
|
141
|
-
req: GetSecretRequest,
|
|
142
|
-
options?: CallOptions
|
|
143
|
-
): Promise<Secret> {
|
|
144
|
-
const url = `${this.host}/api/2.1/unity-catalog/secrets/${req.fullName ?? ''}`;
|
|
145
|
-
const params = new URLSearchParams();
|
|
146
|
-
if (req.includeBrowse !== undefined) {
|
|
147
|
-
params.append('include_browse', String(req.includeBrowse));
|
|
148
|
-
}
|
|
149
|
-
const query = params.toString();
|
|
150
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
151
|
-
let resp: Secret | undefined;
|
|
152
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
153
|
-
const headers = new Headers();
|
|
154
|
-
if (this.workspaceId !== undefined) {
|
|
155
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
156
|
-
}
|
|
157
|
-
headers.set('User-Agent', this.userAgent);
|
|
158
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
159
|
-
const respBody = await executeHttpCall({
|
|
160
|
-
request: httpReq,
|
|
161
|
-
httpClient: this.httpClient,
|
|
162
|
-
logger: this.logger,
|
|
163
|
-
});
|
|
164
|
-
resp = parseResponse(respBody, unmarshalSecretSchema);
|
|
165
|
-
};
|
|
166
|
-
await executeCall(call, options);
|
|
167
|
-
if (resp === undefined) {
|
|
168
|
-
throw new Error('operation completed without a result.');
|
|
169
|
-
}
|
|
170
|
-
return resp;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Lists secrets in Unity Catalog.
|
|
175
|
-
*
|
|
176
|
-
* You must be a metastore admin, the owner of the secret, or have the
|
|
177
|
-
* **MANAGE** privilege on the secret.
|
|
178
|
-
*
|
|
179
|
-
* Both **catalog_name** and **schema_name** must be specified together to filter secrets within
|
|
180
|
-
* a specific schema. Results are paginated; use the **page_token** field from the response
|
|
181
|
-
* to retrieve subsequent pages.
|
|
182
|
-
*/
|
|
183
|
-
async listSecrets(
|
|
184
|
-
req: ListSecretsRequest,
|
|
185
|
-
options?: CallOptions
|
|
186
|
-
): Promise<ListSecretsResponse> {
|
|
187
|
-
const url = `${this.host}/api/2.1/unity-catalog/secrets`;
|
|
188
|
-
const params = new URLSearchParams();
|
|
189
|
-
if (req.catalogName !== undefined) {
|
|
190
|
-
params.append('catalog_name', req.catalogName);
|
|
191
|
-
}
|
|
192
|
-
if (req.schemaName !== undefined) {
|
|
193
|
-
params.append('schema_name', req.schemaName);
|
|
194
|
-
}
|
|
195
|
-
if (req.includeBrowse !== undefined) {
|
|
196
|
-
params.append('include_browse', String(req.includeBrowse));
|
|
197
|
-
}
|
|
198
|
-
if (req.pageToken !== undefined) {
|
|
199
|
-
params.append('page_token', req.pageToken);
|
|
200
|
-
}
|
|
201
|
-
if (req.pageSize !== undefined) {
|
|
202
|
-
params.append('page_size', String(req.pageSize));
|
|
203
|
-
}
|
|
204
|
-
const query = params.toString();
|
|
205
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
206
|
-
let resp: ListSecretsResponse | undefined;
|
|
207
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
208
|
-
const headers = new Headers();
|
|
209
|
-
if (this.workspaceId !== undefined) {
|
|
210
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
211
|
-
}
|
|
212
|
-
headers.set('User-Agent', this.userAgent);
|
|
213
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
214
|
-
const respBody = await executeHttpCall({
|
|
215
|
-
request: httpReq,
|
|
216
|
-
httpClient: this.httpClient,
|
|
217
|
-
logger: this.logger,
|
|
218
|
-
});
|
|
219
|
-
resp = parseResponse(respBody, unmarshalListSecretsResponseSchema);
|
|
220
|
-
};
|
|
221
|
-
await executeCall(call, options);
|
|
222
|
-
if (resp === undefined) {
|
|
223
|
-
throw new Error('operation completed without a result.');
|
|
224
|
-
}
|
|
225
|
-
return resp;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
async *listSecretsIter(
|
|
229
|
-
req: ListSecretsRequest,
|
|
230
|
-
options?: CallOptions
|
|
231
|
-
): AsyncGenerator<Secret> {
|
|
232
|
-
const pageReq: ListSecretsRequest = {...req};
|
|
233
|
-
for (;;) {
|
|
234
|
-
const resp = await this.listSecrets(pageReq, options);
|
|
235
|
-
for (const item of resp.secrets ?? []) {
|
|
236
|
-
yield item;
|
|
237
|
-
}
|
|
238
|
-
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
pageReq.pageToken = resp.nextPageToken;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Updates an existing secret in Unity Catalog.
|
|
247
|
-
*
|
|
248
|
-
* You must be the owner of the secret or a metastore admin. If you are a metastore
|
|
249
|
-
* admin, only the **owner** field can be changed.
|
|
250
|
-
*
|
|
251
|
-
* Use the **update_mask** field to specify which fields to update. Supported updatable fields
|
|
252
|
-
* include **value**, **comment**, **owner**, and **expire_time**.
|
|
253
|
-
*/
|
|
254
|
-
async updateSecret(
|
|
255
|
-
req: UpdateSecretRequest,
|
|
256
|
-
options?: CallOptions
|
|
257
|
-
): Promise<Secret> {
|
|
258
|
-
const url = `${this.host}/api/2.1/unity-catalog/secrets/${req.fullName ?? ''}`;
|
|
259
|
-
const params = new URLSearchParams();
|
|
260
|
-
if (req.updateMask !== undefined) {
|
|
261
|
-
params.append('update_mask', req.updateMask.toString());
|
|
262
|
-
}
|
|
263
|
-
const query = params.toString();
|
|
264
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
265
|
-
const body = marshalRequest(req.secret, marshalSecretSchema);
|
|
266
|
-
let resp: Secret | undefined;
|
|
267
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
268
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
269
|
-
if (this.workspaceId !== undefined) {
|
|
270
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
271
|
-
}
|
|
272
|
-
headers.set('User-Agent', this.userAgent);
|
|
273
|
-
const httpReq = buildHttpRequest(
|
|
274
|
-
'PATCH',
|
|
275
|
-
fullUrl,
|
|
276
|
-
headers,
|
|
277
|
-
callSignal,
|
|
278
|
-
body
|
|
279
|
-
);
|
|
280
|
-
const respBody = await executeHttpCall({
|
|
281
|
-
request: httpReq,
|
|
282
|
-
httpClient: this.httpClient,
|
|
283
|
-
logger: this.logger,
|
|
284
|
-
});
|
|
285
|
-
resp = parseResponse(respBody, unmarshalSecretSchema);
|
|
286
|
-
};
|
|
287
|
-
await executeCall(call, options);
|
|
288
|
-
if (resp === undefined) {
|
|
289
|
-
throw new Error('operation completed without a result.');
|
|
290
|
-
}
|
|
291
|
-
return resp;
|
|
292
|
-
}
|
|
293
|
-
}
|
package/src/v1/index.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
export {SecretsClient} from './client';
|
|
4
|
-
|
|
5
|
-
export type {
|
|
6
|
-
CreateSecretRequest,
|
|
7
|
-
DeleteSecretRequest,
|
|
8
|
-
GetSecretRequest,
|
|
9
|
-
ListSecretsRequest,
|
|
10
|
-
ListSecretsResponse,
|
|
11
|
-
Secret,
|
|
12
|
-
UpdateSecretRequest,
|
|
13
|
-
} from './model';
|
|
14
|
-
|
|
15
|
-
export {secretFieldMask} from './model';
|
package/src/v1/model.ts
DELETED
|
@@ -1,296 +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
|
-
/** Request message for CreateSecret. */
|
|
9
|
-
export interface CreateSecretRequest {
|
|
10
|
-
/**
|
|
11
|
-
* The secret object to create. The **name**, **catalog_name**, **schema_name**, and **value**
|
|
12
|
-
* fields are required.
|
|
13
|
-
*/
|
|
14
|
-
secret?: Secret | undefined;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/** Request message for DeleteSecret. */
|
|
18
|
-
export interface DeleteSecretRequest {
|
|
19
|
-
/**
|
|
20
|
-
* The three-level (fully qualified) name of the secret
|
|
21
|
-
* (for example, **catalog_name.schema_name.secret_name**).
|
|
22
|
-
*/
|
|
23
|
-
fullName?: string | undefined;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** Request message for GetSecret. */
|
|
27
|
-
export interface GetSecretRequest {
|
|
28
|
-
/**
|
|
29
|
-
* The three-level (fully qualified) name of the secret
|
|
30
|
-
* (for example, **catalog_name.schema_name.secret_name**).
|
|
31
|
-
*/
|
|
32
|
-
fullName?: string | undefined;
|
|
33
|
-
/**
|
|
34
|
-
* Whether to include secrets in the response for which you only have the **BROWSE** privilege,
|
|
35
|
-
* which limits access to metadata.
|
|
36
|
-
*/
|
|
37
|
-
includeBrowse?: boolean | undefined;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** Request message for ListSecrets. */
|
|
41
|
-
export interface ListSecretsRequest {
|
|
42
|
-
/**
|
|
43
|
-
* The name of the catalog under which to list secrets. Both **catalog_name** and
|
|
44
|
-
* **schema_name** must be specified together.
|
|
45
|
-
*/
|
|
46
|
-
catalogName?: string | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* The name of the schema under which to list secrets. Both **catalog_name** and
|
|
49
|
-
* **schema_name** must be specified together.
|
|
50
|
-
*/
|
|
51
|
-
schemaName?: string | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Whether to include secrets in the response for which you only have the **BROWSE** privilege,
|
|
54
|
-
* which limits access to metadata.
|
|
55
|
-
*/
|
|
56
|
-
includeBrowse?: boolean | undefined;
|
|
57
|
-
/**
|
|
58
|
-
* Opaque pagination token to go to the next page based on previous query. The maximum page length
|
|
59
|
-
* is determined by a server configured value.
|
|
60
|
-
*/
|
|
61
|
-
pageToken?: string | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* Maximum number of secrets to return.
|
|
64
|
-
*
|
|
65
|
-
* - If not specified, at most 10000 secrets are returned.
|
|
66
|
-
* - If set to a value greater than 0, the page length is the minimum of this value and 10000.
|
|
67
|
-
* - If set to 0, the page length is set to 10000.
|
|
68
|
-
* - If set to a value less than 0, an invalid parameter error is returned.
|
|
69
|
-
*/
|
|
70
|
-
pageSize?: number | undefined;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** Response message for ListSecrets. */
|
|
74
|
-
export interface ListSecretsResponse {
|
|
75
|
-
/** An array of secret objects. */
|
|
76
|
-
secrets?: Secret[] | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* Opaque token to retrieve the next page of results. Absent if there are no more pages.
|
|
79
|
-
* **page_token** should be set to this value for the next request.
|
|
80
|
-
*/
|
|
81
|
-
nextPageToken?: string | undefined;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* A secret stored in Unity Catalog. Secrets are three-level namespace objects
|
|
86
|
-
* (catalog.schema.secret) that securely store sensitive credential data such as
|
|
87
|
-
* passwords, tokens, and keys.
|
|
88
|
-
*/
|
|
89
|
-
export interface Secret {
|
|
90
|
-
/** The name of the secret, relative to its parent schema. */
|
|
91
|
-
name?: string | undefined;
|
|
92
|
-
/**
|
|
93
|
-
* The owner of the secret. Defaults to the creating principal on creation. Can be updated to
|
|
94
|
-
* transfer ownership of the secret to another principal.
|
|
95
|
-
*/
|
|
96
|
-
owner?: string | undefined;
|
|
97
|
-
/**
|
|
98
|
-
* The effective owner of the secret, which may differ from the directly-set **owner** due to
|
|
99
|
-
* inheritance.
|
|
100
|
-
*/
|
|
101
|
-
effectiveOwner?: string | undefined;
|
|
102
|
-
/** Unique identifier of the metastore hosting the secret. */
|
|
103
|
-
metastoreId?: string | undefined;
|
|
104
|
-
/** The time at which this secret was created. */
|
|
105
|
-
createTime?: Temporal.Instant | undefined;
|
|
106
|
-
/** The principal that created the secret. */
|
|
107
|
-
createdBy?: string | undefined;
|
|
108
|
-
/** The time at which this secret was last updated. */
|
|
109
|
-
updateTime?: Temporal.Instant | undefined;
|
|
110
|
-
/** The principal that last updated the secret. */
|
|
111
|
-
updatedBy?: string | undefined;
|
|
112
|
-
/** User-provided free-form text description of the secret. */
|
|
113
|
-
comment?: string | undefined;
|
|
114
|
-
/** The three-level (fully qualified) name of the secret, in the form of **catalog_name.schema_name.secret_name**. */
|
|
115
|
-
fullName?: string | undefined;
|
|
116
|
-
/** The name of the catalog where the schema and the secret reside. */
|
|
117
|
-
catalogName?: string | undefined;
|
|
118
|
-
/** The name of the schema where the secret resides. */
|
|
119
|
-
schemaName?: string | undefined;
|
|
120
|
-
/**
|
|
121
|
-
* The secret value to store. This field is input-only and is not returned in responses — use
|
|
122
|
-
* the **effective_value** field (via GetSecret with **include_value** set to true) to read the
|
|
123
|
-
* secret value. The maximum size is 60 KiB (pre-encryption). Accepted content includes
|
|
124
|
-
* passwords, tokens, keys, and other sensitive credential data.
|
|
125
|
-
*/
|
|
126
|
-
value?: string | undefined;
|
|
127
|
-
/**
|
|
128
|
-
* The secret value. Only populated in responses when you have the **READ_SECRET**
|
|
129
|
-
* privilege and **include_value** is set to true in the request. The maximum size is 60 KiB.
|
|
130
|
-
*/
|
|
131
|
-
effectiveValue?: string | undefined;
|
|
132
|
-
/**
|
|
133
|
-
* Indicates whether the principal is limited to retrieving metadata for the associated object
|
|
134
|
-
* through the **BROWSE** privilege when **include_browse** is enabled in the request.
|
|
135
|
-
*/
|
|
136
|
-
browseOnly?: boolean | undefined;
|
|
137
|
-
/**
|
|
138
|
-
* User-provided expiration time of the secret. This field indicates when the secret should no
|
|
139
|
-
* longer be used and may be displayed as a warning in the UI. It is purely informational and
|
|
140
|
-
* does not trigger any automatic actions or affect the secret's lifecycle.
|
|
141
|
-
*/
|
|
142
|
-
expireTime?: Temporal.Instant | undefined;
|
|
143
|
-
externalSecretId?: string | undefined;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/** Request message for UpdateSecret. */
|
|
147
|
-
export interface UpdateSecretRequest {
|
|
148
|
-
/**
|
|
149
|
-
* The three-level (fully qualified) name of the secret
|
|
150
|
-
* (for example, **catalog_name.schema_name.secret_name**).
|
|
151
|
-
*/
|
|
152
|
-
fullName?: string | undefined;
|
|
153
|
-
/**
|
|
154
|
-
* The secret object containing the fields to update. Only fields specified in **update_mask**
|
|
155
|
-
* will be updated.
|
|
156
|
-
*/
|
|
157
|
-
secret?: Secret | undefined;
|
|
158
|
-
/**
|
|
159
|
-
* The field mask specifying which fields of the secret to update. Supported fields: **value**,
|
|
160
|
-
* **comment**, **owner**, **expire_time**.
|
|
161
|
-
*/
|
|
162
|
-
updateMask?: FieldMask<Secret> | undefined;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export const unmarshalListSecretsResponseSchema: z.ZodType<ListSecretsResponse> =
|
|
166
|
-
z
|
|
167
|
-
.object({
|
|
168
|
-
secrets: z.array(z.lazy(() => unmarshalSecretSchema)).optional(),
|
|
169
|
-
next_page_token: z.string().optional(),
|
|
170
|
-
})
|
|
171
|
-
.transform(d => ({
|
|
172
|
-
secrets: d.secrets,
|
|
173
|
-
nextPageToken: d.next_page_token,
|
|
174
|
-
}));
|
|
175
|
-
|
|
176
|
-
export const unmarshalSecretSchema: z.ZodType<Secret> = z
|
|
177
|
-
.object({
|
|
178
|
-
name: z.string().optional(),
|
|
179
|
-
owner: z.string().optional(),
|
|
180
|
-
effective_owner: z.string().optional(),
|
|
181
|
-
metastore_id: z.string().optional(),
|
|
182
|
-
create_time: z
|
|
183
|
-
.string()
|
|
184
|
-
.transform(s => Temporal.Instant.from(s))
|
|
185
|
-
.optional(),
|
|
186
|
-
created_by: z.string().optional(),
|
|
187
|
-
update_time: z
|
|
188
|
-
.string()
|
|
189
|
-
.transform(s => Temporal.Instant.from(s))
|
|
190
|
-
.optional(),
|
|
191
|
-
updated_by: z.string().optional(),
|
|
192
|
-
comment: z.string().optional(),
|
|
193
|
-
full_name: z.string().optional(),
|
|
194
|
-
catalog_name: z.string().optional(),
|
|
195
|
-
schema_name: z.string().optional(),
|
|
196
|
-
value: z.string().optional(),
|
|
197
|
-
effective_value: z.string().optional(),
|
|
198
|
-
browse_only: z.boolean().optional(),
|
|
199
|
-
expire_time: z
|
|
200
|
-
.string()
|
|
201
|
-
.transform(s => Temporal.Instant.from(s))
|
|
202
|
-
.optional(),
|
|
203
|
-
external_secret_id: z.string().optional(),
|
|
204
|
-
})
|
|
205
|
-
.transform(d => ({
|
|
206
|
-
name: d.name,
|
|
207
|
-
owner: d.owner,
|
|
208
|
-
effectiveOwner: d.effective_owner,
|
|
209
|
-
metastoreId: d.metastore_id,
|
|
210
|
-
createTime: d.create_time,
|
|
211
|
-
createdBy: d.created_by,
|
|
212
|
-
updateTime: d.update_time,
|
|
213
|
-
updatedBy: d.updated_by,
|
|
214
|
-
comment: d.comment,
|
|
215
|
-
fullName: d.full_name,
|
|
216
|
-
catalogName: d.catalog_name,
|
|
217
|
-
schemaName: d.schema_name,
|
|
218
|
-
value: d.value,
|
|
219
|
-
effectiveValue: d.effective_value,
|
|
220
|
-
browseOnly: d.browse_only,
|
|
221
|
-
expireTime: d.expire_time,
|
|
222
|
-
externalSecretId: d.external_secret_id,
|
|
223
|
-
}));
|
|
224
|
-
|
|
225
|
-
export const marshalSecretSchema: z.ZodType = z
|
|
226
|
-
.object({
|
|
227
|
-
name: z.string().optional(),
|
|
228
|
-
owner: z.string().optional(),
|
|
229
|
-
effectiveOwner: z.string().optional(),
|
|
230
|
-
metastoreId: z.string().optional(),
|
|
231
|
-
createTime: z
|
|
232
|
-
.any()
|
|
233
|
-
.transform((d: Temporal.Instant) => d.toString())
|
|
234
|
-
.optional(),
|
|
235
|
-
createdBy: z.string().optional(),
|
|
236
|
-
updateTime: z
|
|
237
|
-
.any()
|
|
238
|
-
.transform((d: Temporal.Instant) => d.toString())
|
|
239
|
-
.optional(),
|
|
240
|
-
updatedBy: z.string().optional(),
|
|
241
|
-
comment: z.string().optional(),
|
|
242
|
-
fullName: z.string().optional(),
|
|
243
|
-
catalogName: z.string().optional(),
|
|
244
|
-
schemaName: z.string().optional(),
|
|
245
|
-
value: z.string().optional(),
|
|
246
|
-
effectiveValue: z.string().optional(),
|
|
247
|
-
browseOnly: z.boolean().optional(),
|
|
248
|
-
expireTime: z
|
|
249
|
-
.any()
|
|
250
|
-
.transform((d: Temporal.Instant) => d.toString())
|
|
251
|
-
.optional(),
|
|
252
|
-
externalSecretId: z.string().optional(),
|
|
253
|
-
})
|
|
254
|
-
.transform(d => ({
|
|
255
|
-
name: d.name,
|
|
256
|
-
owner: d.owner,
|
|
257
|
-
effective_owner: d.effectiveOwner,
|
|
258
|
-
metastore_id: d.metastoreId,
|
|
259
|
-
create_time: d.createTime,
|
|
260
|
-
created_by: d.createdBy,
|
|
261
|
-
update_time: d.updateTime,
|
|
262
|
-
updated_by: d.updatedBy,
|
|
263
|
-
comment: d.comment,
|
|
264
|
-
full_name: d.fullName,
|
|
265
|
-
catalog_name: d.catalogName,
|
|
266
|
-
schema_name: d.schemaName,
|
|
267
|
-
value: d.value,
|
|
268
|
-
effective_value: d.effectiveValue,
|
|
269
|
-
browse_only: d.browseOnly,
|
|
270
|
-
expire_time: d.expireTime,
|
|
271
|
-
external_secret_id: d.externalSecretId,
|
|
272
|
-
}));
|
|
273
|
-
|
|
274
|
-
const secretFieldMaskSchema: FieldMaskSchema = {
|
|
275
|
-
browseOnly: {wire: 'browse_only'},
|
|
276
|
-
catalogName: {wire: 'catalog_name'},
|
|
277
|
-
comment: {wire: 'comment'},
|
|
278
|
-
createTime: {wire: 'create_time'},
|
|
279
|
-
createdBy: {wire: 'created_by'},
|
|
280
|
-
effectiveOwner: {wire: 'effective_owner'},
|
|
281
|
-
effectiveValue: {wire: 'effective_value'},
|
|
282
|
-
expireTime: {wire: 'expire_time'},
|
|
283
|
-
externalSecretId: {wire: 'external_secret_id'},
|
|
284
|
-
fullName: {wire: 'full_name'},
|
|
285
|
-
metastoreId: {wire: 'metastore_id'},
|
|
286
|
-
name: {wire: 'name'},
|
|
287
|
-
owner: {wire: 'owner'},
|
|
288
|
-
schemaName: {wire: 'schema_name'},
|
|
289
|
-
updateTime: {wire: 'update_time'},
|
|
290
|
-
updatedBy: {wire: 'updated_by'},
|
|
291
|
-
value: {wire: 'value'},
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
export function secretFieldMask(...paths: string[]): FieldMask<Secret> {
|
|
295
|
-
return FieldMask.build<Secret>(paths, secretFieldMaskSchema);
|
|
296
|
-
}
|
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
|
-
}
|