@databricks/sdk-uc-secrets 0.34.0 → 0.36.0
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/dist/package.js +7 -0
- package/dist/package.js.map +1 -0
- package/dist/v1/client.d.ts +62 -58
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +190 -234
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/index.d.ts +3 -7
- package/dist/v1/index.js +4 -7
- package/dist/v1/model.d.ts +136 -132
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +95 -115
- package/dist/v1/model.js.map +1 -1
- package/dist/v1/transport.d.ts +21 -17
- package/dist/v1/transport.d.ts.map +1 -1
- package/dist/v1/transport.js +60 -69
- package/dist/v1/transport.js.map +1 -1
- package/dist/v1/utils.d.ts +18 -14
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +76 -103
- package/dist/v1/utils.js.map +1 -1
- package/package.json +5 -5
- package/dist/v1/index.d.ts.map +0 -1
- package/dist/v1/index.js.map +0 -1
package/dist/package.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
|
package/dist/v1/client.d.ts
CHANGED
|
@@ -1,60 +1,64 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
1
|
+
import { CreateSecretRequest, DeleteSecretRequest, GetSecretRequest, ListSecretsRequest, ListSecretsResponse, Secret, UpdateSecretRequest } from "./model.js";
|
|
2
|
+
import { CallOptions } from "@databricks/sdk-options/call";
|
|
3
|
+
import { ClientOptions } from "@databricks/sdk-options/client";
|
|
4
|
+
|
|
5
|
+
//#region src/v1/client.d.ts
|
|
6
|
+
declare class SecretsClient {
|
|
7
|
+
private readonly options;
|
|
8
|
+
private readonly logger;
|
|
9
|
+
private readonly userAgent;
|
|
10
|
+
private config;
|
|
11
|
+
constructor(options: ClientOptions);
|
|
12
|
+
private resolveConfig;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new secret in Unity Catalog.
|
|
15
|
+
*
|
|
16
|
+
* You must be the owner of the parent schema or have the **CREATE_SECRET** and **USE SCHEMA**
|
|
17
|
+
* privileges on the parent schema and **USE CATALOG** on the parent catalog.
|
|
18
|
+
*
|
|
19
|
+
* The secret is stored in the specified catalog and schema, and the **value** field
|
|
20
|
+
* contains the sensitive data to be securely stored.
|
|
21
|
+
*/
|
|
22
|
+
createSecret(req: CreateSecretRequest, options?: CallOptions): Promise<Secret>;
|
|
23
|
+
/**
|
|
24
|
+
* Deletes a secret by its three-level (fully qualified) name.
|
|
25
|
+
*
|
|
26
|
+
* You must be the owner of the secret or a metastore admin.
|
|
27
|
+
*/
|
|
28
|
+
deleteSecret(req: DeleteSecretRequest, options?: CallOptions): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Gets a secret by its three-level (fully qualified) name.
|
|
31
|
+
*
|
|
32
|
+
* You must be a metastore admin, the owner of the secret, or have the **MANAGE**
|
|
33
|
+
* privilege on the secret.
|
|
34
|
+
*
|
|
35
|
+
* The secret value isn't returned by default. To retrieve it, you must also have the
|
|
36
|
+
* **READ_SECRET** privilege and set **include_value** to true in the request.
|
|
37
|
+
*/
|
|
38
|
+
getSecret(req: GetSecretRequest, options?: CallOptions): Promise<Secret>;
|
|
39
|
+
/**
|
|
40
|
+
* Lists secrets in Unity Catalog.
|
|
41
|
+
*
|
|
42
|
+
* You must be a metastore admin, the owner of the secret, or have the
|
|
43
|
+
* **MANAGE** privilege on the secret.
|
|
44
|
+
*
|
|
45
|
+
* Both **catalog_name** and **schema_name** must be specified together to filter secrets within
|
|
46
|
+
* a specific schema. Results are paginated; use the **page_token** field from the response
|
|
47
|
+
* to retrieve subsequent pages.
|
|
48
|
+
*/
|
|
49
|
+
listSecrets(req: ListSecretsRequest, options?: CallOptions): Promise<ListSecretsResponse>;
|
|
50
|
+
listSecretsIter(req: ListSecretsRequest, options?: CallOptions): AsyncGenerator<Secret>;
|
|
51
|
+
/**
|
|
52
|
+
* Updates an existing secret in Unity Catalog.
|
|
53
|
+
*
|
|
54
|
+
* You must be the owner of the secret or a metastore admin. If you are a metastore
|
|
55
|
+
* admin, only the **owner** field can be changed.
|
|
56
|
+
*
|
|
57
|
+
* Use the **update_mask** field to specify which fields to update. Supported updatable fields
|
|
58
|
+
* include **value**, **comment**, **owner**, and **expire_time**.
|
|
59
|
+
*/
|
|
60
|
+
updateSecret(req: UpdateSecretRequest, options?: CallOptions): Promise<Secret>;
|
|
59
61
|
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { SecretsClient };
|
|
60
64
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/v1/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/v1/client.ts"],"mappings":";;;;;cAuCa,aAAA;EAAA,iBACM,OAAA;EAAA,iBACA,MAAA;EAAA,iBAIA,SAAA;EAAA,QAIT,MAAA;cAEI,OAAA,EAAS,aAAA;EAAA,QAUb,aAAA;EAgBI;;;;;;;;;EAFN,YAAA,CACJ,GAAA,EAAK,mBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,MAAA;EA2GJ;;;;;EA5ED,YAAA,CACJ,GAAA,EAAK,mBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA;EAsHe;;;;;;;;;EA1FZ,SAAA,CACJ,GAAA,EAAK,gBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,MAAA;EAlGM;;;;;;;;;;EA2IX,WAAA,CACJ,GAAA,EAAK,kBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,mBAAA;EAwCJ,eAAA,CACL,GAAA,EAAK,kBAAA,EACL,OAAA,GAAU,WAAA,GACT,cAAA,CAAe,MAAA;EAxJP;;;;;;;;;EA+KL,YAAA,CACJ,GAAA,EAAK,mBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,MAAA;AAAA"}
|
package/dist/v1/client.js
CHANGED
|
@@ -1,237 +1,193 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { resolveClientConfig } from "./transport.js";
|
|
2
|
+
import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse } from "./utils.js";
|
|
3
|
+
import { name, version } from "../package.js";
|
|
4
|
+
import { marshalSecretSchema, unmarshalListSecretsResponseSchema, unmarshalSecretSchema } from "./model.js";
|
|
5
|
+
import { VERSION } from "@databricks/sdk-auth";
|
|
6
|
+
import { createDefault } from "@databricks/sdk-core/clientinfo";
|
|
7
|
+
import { NoOpLogger } from "@databricks/sdk-core/logger";
|
|
8
|
+
|
|
9
|
+
//#region src/v1/client.ts
|
|
10
10
|
const PACKAGE_SEGMENT = {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
key: "sdk-js-" + name.replace(/^@[^/]+\/sdk-/, ""),
|
|
12
|
+
value: version
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
pageReq.pageToken = resp.nextPageToken;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Updates an existing secret in Unity Catalog.
|
|
198
|
-
*
|
|
199
|
-
* You must be the owner of the secret or a metastore admin. If you are a metastore
|
|
200
|
-
* admin, only the **owner** field can be changed.
|
|
201
|
-
*
|
|
202
|
-
* Use the **update_mask** field to specify which fields to update. Supported updatable fields
|
|
203
|
-
* include **value**, **comment**, **owner**, and **expire_time**.
|
|
204
|
-
*/
|
|
205
|
-
async updateSecret(req, options) {
|
|
206
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
207
|
-
const url = `${host}/api/2.1/unity-catalog/secrets/${req.fullName ?? ''}`;
|
|
208
|
-
const params = new URLSearchParams();
|
|
209
|
-
if (req.updateMask !== undefined) {
|
|
210
|
-
params.append('update_mask', req.updateMask.toString());
|
|
211
|
-
}
|
|
212
|
-
const query = params.toString();
|
|
213
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
214
|
-
const body = marshalRequest(req.secret, marshalSecretSchema);
|
|
215
|
-
let resp;
|
|
216
|
-
const call = async (callSignal) => {
|
|
217
|
-
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
218
|
-
if (workspaceId !== undefined) {
|
|
219
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
220
|
-
}
|
|
221
|
-
headers.set('User-Agent', this.userAgent);
|
|
222
|
-
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
223
|
-
const respBody = await executeHttpCall({
|
|
224
|
-
request: httpReq,
|
|
225
|
-
httpClient,
|
|
226
|
-
logger: this.logger,
|
|
227
|
-
});
|
|
228
|
-
resp = parseResponse(respBody, unmarshalSecretSchema);
|
|
229
|
-
};
|
|
230
|
-
await executeCall(call, options);
|
|
231
|
-
if (resp === undefined) {
|
|
232
|
-
throw new Error('operation completed without a result.');
|
|
233
|
-
}
|
|
234
|
-
return resp;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
14
|
+
var SecretsClient = class {
|
|
15
|
+
options;
|
|
16
|
+
logger;
|
|
17
|
+
userAgent;
|
|
18
|
+
config;
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.options = options;
|
|
21
|
+
this.logger = options.logger ?? new NoOpLogger();
|
|
22
|
+
this.userAgent = createDefault().with(PACKAGE_SEGMENT).with({
|
|
23
|
+
key: "sdk-js-auth",
|
|
24
|
+
value: VERSION
|
|
25
|
+
}).with({
|
|
26
|
+
key: "auth",
|
|
27
|
+
value: options.credentials?.name() ?? "default"
|
|
28
|
+
}).toString();
|
|
29
|
+
}
|
|
30
|
+
resolveConfig() {
|
|
31
|
+
this.config ??= resolveClientConfig(this.options);
|
|
32
|
+
return this.config;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new secret in Unity Catalog.
|
|
36
|
+
*
|
|
37
|
+
* You must be the owner of the parent schema or have the **CREATE_SECRET** and **USE SCHEMA**
|
|
38
|
+
* privileges on the parent schema and **USE CATALOG** on the parent catalog.
|
|
39
|
+
*
|
|
40
|
+
* The secret is stored in the specified catalog and schema, and the **value** field
|
|
41
|
+
* contains the sensitive data to be securely stored.
|
|
42
|
+
*/
|
|
43
|
+
async createSecret(req, options) {
|
|
44
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
45
|
+
const url = `${host}/api/2.1/unity-catalog/secrets`;
|
|
46
|
+
const body = marshalRequest(req.secret, marshalSecretSchema);
|
|
47
|
+
let resp;
|
|
48
|
+
const call = async (callSignal) => {
|
|
49
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
50
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
51
|
+
headers.set("User-Agent", this.userAgent);
|
|
52
|
+
resp = parseResponse(await executeHttpCall({
|
|
53
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
54
|
+
httpClient,
|
|
55
|
+
logger: this.logger
|
|
56
|
+
}), unmarshalSecretSchema);
|
|
57
|
+
};
|
|
58
|
+
await executeCall(call, options);
|
|
59
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
60
|
+
return resp;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Deletes a secret by its three-level (fully qualified) name.
|
|
64
|
+
*
|
|
65
|
+
* You must be the owner of the secret or a metastore admin.
|
|
66
|
+
*/
|
|
67
|
+
async deleteSecret(req, options) {
|
|
68
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
69
|
+
const url = `${host}/api/2.1/unity-catalog/secrets/${req.fullName ?? ""}`;
|
|
70
|
+
const call = async (callSignal) => {
|
|
71
|
+
const headers = new Headers();
|
|
72
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
73
|
+
headers.set("User-Agent", this.userAgent);
|
|
74
|
+
await executeHttpCall({
|
|
75
|
+
request: buildHttpRequest("DELETE", url, headers, callSignal),
|
|
76
|
+
httpClient,
|
|
77
|
+
logger: this.logger
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
await executeCall(call, options);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Gets a secret by its three-level (fully qualified) name.
|
|
84
|
+
*
|
|
85
|
+
* You must be a metastore admin, the owner of the secret, or have the **MANAGE**
|
|
86
|
+
* privilege on the secret.
|
|
87
|
+
*
|
|
88
|
+
* The secret value isn't returned by default. To retrieve it, you must also have the
|
|
89
|
+
* **READ_SECRET** privilege and set **include_value** to true in the request.
|
|
90
|
+
*/
|
|
91
|
+
async getSecret(req, options) {
|
|
92
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
93
|
+
const url = `${host}/api/2.1/unity-catalog/secrets/${req.fullName ?? ""}`;
|
|
94
|
+
const params = new URLSearchParams();
|
|
95
|
+
if (req.includeValue !== void 0) params.append("include_value", String(req.includeValue));
|
|
96
|
+
const query = params.toString();
|
|
97
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
98
|
+
let resp;
|
|
99
|
+
const call = async (callSignal) => {
|
|
100
|
+
const headers = new Headers();
|
|
101
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
102
|
+
headers.set("User-Agent", this.userAgent);
|
|
103
|
+
resp = parseResponse(await executeHttpCall({
|
|
104
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
105
|
+
httpClient,
|
|
106
|
+
logger: this.logger
|
|
107
|
+
}), unmarshalSecretSchema);
|
|
108
|
+
};
|
|
109
|
+
await executeCall(call, options);
|
|
110
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
111
|
+
return resp;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Lists secrets in Unity Catalog.
|
|
115
|
+
*
|
|
116
|
+
* You must be a metastore admin, the owner of the secret, or have the
|
|
117
|
+
* **MANAGE** privilege on the secret.
|
|
118
|
+
*
|
|
119
|
+
* Both **catalog_name** and **schema_name** must be specified together to filter secrets within
|
|
120
|
+
* a specific schema. Results are paginated; use the **page_token** field from the response
|
|
121
|
+
* to retrieve subsequent pages.
|
|
122
|
+
*/
|
|
123
|
+
async listSecrets(req, options) {
|
|
124
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
125
|
+
const url = `${host}/api/2.1/unity-catalog/secrets`;
|
|
126
|
+
const params = new URLSearchParams();
|
|
127
|
+
if (req.catalogName !== void 0) params.append("catalog_name", req.catalogName);
|
|
128
|
+
if (req.schemaName !== void 0) params.append("schema_name", req.schemaName);
|
|
129
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
130
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
131
|
+
const query = params.toString();
|
|
132
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
133
|
+
let resp;
|
|
134
|
+
const call = async (callSignal) => {
|
|
135
|
+
const headers = new Headers();
|
|
136
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
137
|
+
headers.set("User-Agent", this.userAgent);
|
|
138
|
+
resp = parseResponse(await executeHttpCall({
|
|
139
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
140
|
+
httpClient,
|
|
141
|
+
logger: this.logger
|
|
142
|
+
}), unmarshalListSecretsResponseSchema);
|
|
143
|
+
};
|
|
144
|
+
await executeCall(call, options);
|
|
145
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
146
|
+
return resp;
|
|
147
|
+
}
|
|
148
|
+
async *listSecretsIter(req, options) {
|
|
149
|
+
const pageReq = { ...req };
|
|
150
|
+
for (;;) {
|
|
151
|
+
const resp = await this.listSecrets(pageReq, options);
|
|
152
|
+
for (const item of resp.secrets ?? []) yield item;
|
|
153
|
+
if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
|
|
154
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Updates an existing secret in Unity Catalog.
|
|
159
|
+
*
|
|
160
|
+
* You must be the owner of the secret or a metastore admin. If you are a metastore
|
|
161
|
+
* admin, only the **owner** field can be changed.
|
|
162
|
+
*
|
|
163
|
+
* Use the **update_mask** field to specify which fields to update. Supported updatable fields
|
|
164
|
+
* include **value**, **comment**, **owner**, and **expire_time**.
|
|
165
|
+
*/
|
|
166
|
+
async updateSecret(req, options) {
|
|
167
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
168
|
+
const url = `${host}/api/2.1/unity-catalog/secrets/${req.fullName ?? ""}`;
|
|
169
|
+
const params = new URLSearchParams();
|
|
170
|
+
if (req.updateMask !== void 0) params.append("update_mask", req.updateMask.toString());
|
|
171
|
+
const query = params.toString();
|
|
172
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
173
|
+
const body = marshalRequest(req.secret, marshalSecretSchema);
|
|
174
|
+
let resp;
|
|
175
|
+
const call = async (callSignal) => {
|
|
176
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
177
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
178
|
+
headers.set("User-Agent", this.userAgent);
|
|
179
|
+
resp = parseResponse(await executeHttpCall({
|
|
180
|
+
request: buildHttpRequest("PATCH", fullUrl, headers, callSignal, body),
|
|
181
|
+
httpClient,
|
|
182
|
+
logger: this.logger
|
|
183
|
+
}), unmarshalSecretSchema);
|
|
184
|
+
};
|
|
185
|
+
await executeCall(call, options);
|
|
186
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
187
|
+
return resp;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
//#endregion
|
|
192
|
+
export { SecretsClient };
|
|
237
193
|
//# sourceMappingURL=client.js.map
|