@databricks/sdk-postgres 0.52.6 → 0.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.js +1 -1
- package/dist/v1/client.d.ts +185 -4
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +650 -24
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/index.d.ts +3 -3
- package/dist/v1/index.js +3 -3
- package/dist/v1/model.d.ts +351 -8
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +246 -34
- package/dist/v1/model.js.map +1 -1
- package/package.json +5 -5
package/dist/v1/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveClientConfig } from "./transport.js";
|
|
2
2
|
import { StillRunningError, buildHttpRequest, executeCall, executeHttpCall, executeWait, marshalRequest, parseResponse } from "./utils.js";
|
|
3
3
|
import { name, version } from "../package.js";
|
|
4
|
-
import { marshalBranchSchema, marshalCatalogSchema, marshalCdfConfigSchema, marshalDataApiSchema, marshalDatabaseSchema, marshalEndpointSchema, marshalGenerateDatabaseCredentialRequestSchema, marshalProjectSchema, marshalRevealRolePasswordRequestSchema, marshalRoleSchema, marshalSnapshotScheduleSchema, marshalSnapshotSchema, marshalSyncedTableSchema, marshalUndeleteBranchRequestSchema, marshalUndeleteProjectRequestSchema, unmarshalBranchOperationMetadataSchema, unmarshalBranchSchema, unmarshalCatalogOperationMetadataSchema, unmarshalCatalogSchema, unmarshalCdfConfigOperationMetadataSchema, unmarshalCdfConfigSchema, unmarshalCdfStatusSchema, unmarshalDataApiOperationMetadataSchema, unmarshalDataApiSchema, unmarshalDatabaseCredentialSchema, unmarshalDatabaseOperationMetadataSchema, unmarshalDatabaseSchema, unmarshalEndpointOperationMetadataSchema, unmarshalEndpointSchema, unmarshalListBranchesResponseSchema, unmarshalListCdfConfigsResponseSchema, unmarshalListCdfStatusesResponseSchema, unmarshalListDatabasesResponseSchema, unmarshalListEndpointsResponseSchema, unmarshalListProjectsResponseSchema, unmarshalListRolesResponseSchema, unmarshalListSnapshotsResponseSchema, unmarshalOperationSchema, unmarshalProjectOperationMetadataSchema, unmarshalProjectSchema, unmarshalRevealRolePasswordResponseSchema, unmarshalRoleOperationMetadataSchema, unmarshalRoleSchema, unmarshalSnapshotOperationMetadataSchema, unmarshalSnapshotScheduleOperationMetadataSchema, unmarshalSnapshotScheduleSchema, unmarshalSnapshotSchema, unmarshalSyncedTableOperationMetadataSchema, unmarshalSyncedTableSchema } from "./model.js";
|
|
4
|
+
import { marshalAcknowledgeAssessmentWarningsRequestSchema, marshalAssessMigrationRequestSchema, marshalBranchSchema, marshalCatalogSchema, marshalCdfConfigSchema, marshalDataApiSchema, marshalDatabaseSchema, marshalEndpointSchema, marshalGenerateDatabaseCredentialRequestSchema, marshalMigrationSchema, marshalProjectSchema, marshalRevealRolePasswordRequestSchema, marshalRoleSchema, marshalSnapshotScheduleSchema, marshalSnapshotSchema, marshalStartMigrationRequestSchema, marshalSyncedTableSchema, marshalUndeleteBranchRequestSchema, marshalUndeleteMigrationRequestSchema, marshalUndeleteProjectRequestSchema, unmarshalAcknowledgeAssessmentWarningsResponseSchema, unmarshalAssessMigrationResponseSchema, unmarshalAssessmentSchema, unmarshalBranchOperationMetadataSchema, unmarshalBranchSchema, unmarshalCatalogOperationMetadataSchema, unmarshalCatalogSchema, unmarshalCdfConfigOperationMetadataSchema, unmarshalCdfConfigSchema, unmarshalCdfStatusSchema, unmarshalDataApiOperationMetadataSchema, unmarshalDataApiSchema, unmarshalDatabaseCredentialSchema, unmarshalDatabaseOperationMetadataSchema, unmarshalDatabaseSchema, unmarshalEndpointOperationMetadataSchema, unmarshalEndpointSchema, unmarshalListAssessmentsResponseSchema, unmarshalListBranchesResponseSchema, unmarshalListCdfConfigsResponseSchema, unmarshalListCdfStatusesResponseSchema, unmarshalListDatabasesResponseSchema, unmarshalListEndpointsResponseSchema, unmarshalListMigrationsResponseSchema, unmarshalListProjectsResponseSchema, unmarshalListRolesResponseSchema, unmarshalListSnapshotsResponseSchema, unmarshalMigrationOperationMetadataSchema, unmarshalMigrationSchema, unmarshalOperationSchema, unmarshalProjectOperationMetadataSchema, unmarshalProjectSchema, unmarshalRevealRolePasswordResponseSchema, unmarshalRoleOperationMetadataSchema, unmarshalRoleSchema, unmarshalSnapshotOperationMetadataSchema, unmarshalSnapshotScheduleOperationMetadataSchema, unmarshalSnapshotScheduleSchema, unmarshalSnapshotSchema, unmarshalStartMigrationResponseSchema, unmarshalSyncedTableOperationMetadataSchema, unmarshalSyncedTableSchema, unmarshalUndeleteMigrationResponseSchema } from "./model.js";
|
|
5
5
|
import { VERSION } from "@databricks/sdk-auth";
|
|
6
6
|
import { createDefault } from "@databricks/sdk-core/clientinfo";
|
|
7
7
|
import { NoOpLogger } from "@databricks/sdk-core/logger";
|
|
@@ -32,6 +32,54 @@ var PostgresClient = class {
|
|
|
32
32
|
this.config ??= resolveClientConfig(this.options);
|
|
33
33
|
return this.config;
|
|
34
34
|
}
|
|
35
|
+
/** Acknowledges non-blocking warnings on a specific assessment. */
|
|
36
|
+
async acknowledgeAssessmentWarningsBase(req, options) {
|
|
37
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
38
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ""}/acknowledgeWarnings`;
|
|
39
|
+
const body = marshalRequest(req, marshalAcknowledgeAssessmentWarningsRequestSchema);
|
|
40
|
+
let resp;
|
|
41
|
+
const call = async (callSignal) => {
|
|
42
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
43
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
44
|
+
headers.set("User-Agent", this.userAgent);
|
|
45
|
+
resp = parseResponse(await executeHttpCall({
|
|
46
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
47
|
+
httpClient,
|
|
48
|
+
logger: this.logger
|
|
49
|
+
}), unmarshalOperationSchema);
|
|
50
|
+
};
|
|
51
|
+
await executeCall(call, options);
|
|
52
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
53
|
+
return resp;
|
|
54
|
+
}
|
|
55
|
+
/** Acknowledges non-blocking warnings on a specific assessment. */
|
|
56
|
+
async acknowledgeAssessmentWarnings(req, options) {
|
|
57
|
+
return new AcknowledgeAssessmentWarningsOperation(await this.acknowledgeAssessmentWarningsBase(req, options), (req, options) => this.getOperation(req, options));
|
|
58
|
+
}
|
|
59
|
+
/** Creates an immutable assessment run for the migration's current source configuration. */
|
|
60
|
+
async assessMigrationBase(req, options) {
|
|
61
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
62
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ""}/assess`;
|
|
63
|
+
const body = marshalRequest(req, marshalAssessMigrationRequestSchema);
|
|
64
|
+
let resp;
|
|
65
|
+
const call = async (callSignal) => {
|
|
66
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
67
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
68
|
+
headers.set("User-Agent", this.userAgent);
|
|
69
|
+
resp = parseResponse(await executeHttpCall({
|
|
70
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
71
|
+
httpClient,
|
|
72
|
+
logger: this.logger
|
|
73
|
+
}), unmarshalOperationSchema);
|
|
74
|
+
};
|
|
75
|
+
await executeCall(call, options);
|
|
76
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
77
|
+
return resp;
|
|
78
|
+
}
|
|
79
|
+
/** Creates an immutable assessment run for the migration's current source configuration. */
|
|
80
|
+
async assessMigration(req, options) {
|
|
81
|
+
return new AssessMigrationOperation(await this.assessMigrationBase(req, options), (req, options) => this.getOperation(req, options));
|
|
82
|
+
}
|
|
35
83
|
/** Creates a new database branch in the project. */
|
|
36
84
|
async createBranchBase(req, options) {
|
|
37
85
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
@@ -217,6 +265,34 @@ var PostgresClient = class {
|
|
|
217
265
|
async createEndpoint(req, options) {
|
|
218
266
|
return new CreateEndpointOperation(await this.createEndpointBase(req, options), (req, options) => this.getOperation(req, options));
|
|
219
267
|
}
|
|
268
|
+
/** Creates a migration. */
|
|
269
|
+
async createMigrationBase(req, options) {
|
|
270
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
271
|
+
const url = `${host}/api/2.0/postgres/migrations`;
|
|
272
|
+
const params = new URLSearchParams();
|
|
273
|
+
if (req.migrationId !== void 0) params.append("migration_id", req.migrationId);
|
|
274
|
+
const query = params.toString();
|
|
275
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
276
|
+
const body = marshalRequest(req.migration, marshalMigrationSchema);
|
|
277
|
+
let resp;
|
|
278
|
+
const call = async (callSignal) => {
|
|
279
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
280
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
281
|
+
headers.set("User-Agent", this.userAgent);
|
|
282
|
+
resp = parseResponse(await executeHttpCall({
|
|
283
|
+
request: buildHttpRequest("POST", fullUrl, headers, callSignal, body),
|
|
284
|
+
httpClient,
|
|
285
|
+
logger: this.logger
|
|
286
|
+
}), unmarshalOperationSchema);
|
|
287
|
+
};
|
|
288
|
+
await executeCall(call, options);
|
|
289
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
290
|
+
return resp;
|
|
291
|
+
}
|
|
292
|
+
/** Creates a migration. */
|
|
293
|
+
async createMigration(req, options) {
|
|
294
|
+
return new CreateMigrationOperation(await this.createMigrationBase(req, options), (req, options) => this.getOperation(req, options));
|
|
295
|
+
}
|
|
220
296
|
/** Creates a new Lakebase Autoscaling Postgres database project, which contains branches and compute endpoints. */
|
|
221
297
|
async createProjectBase(req, options) {
|
|
222
298
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
@@ -484,6 +560,29 @@ var PostgresClient = class {
|
|
|
484
560
|
async deleteEndpoint(req, options) {
|
|
485
561
|
return new DeleteEndpointOperation(await this.deleteEndpointBase(req, options), (req, options) => this.getOperation(req, options));
|
|
486
562
|
}
|
|
563
|
+
/** Soft-deletes a migration. */
|
|
564
|
+
async deleteMigrationBase(req, options) {
|
|
565
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
566
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ""}`;
|
|
567
|
+
let resp;
|
|
568
|
+
const call = async (callSignal) => {
|
|
569
|
+
const headers = new Headers();
|
|
570
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
571
|
+
headers.set("User-Agent", this.userAgent);
|
|
572
|
+
resp = parseResponse(await executeHttpCall({
|
|
573
|
+
request: buildHttpRequest("DELETE", url, headers, callSignal),
|
|
574
|
+
httpClient,
|
|
575
|
+
logger: this.logger
|
|
576
|
+
}), unmarshalOperationSchema);
|
|
577
|
+
};
|
|
578
|
+
await executeCall(call, options);
|
|
579
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
580
|
+
return resp;
|
|
581
|
+
}
|
|
582
|
+
/** Soft-deletes a migration. */
|
|
583
|
+
async deleteMigration(req, options) {
|
|
584
|
+
return new DeleteMigrationOperation(await this.deleteMigrationBase(req, options), (req, options) => this.getOperation(req, options));
|
|
585
|
+
}
|
|
487
586
|
/** Deletes the specified database project. */
|
|
488
587
|
async deleteProjectBase(req, options) {
|
|
489
588
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
@@ -604,6 +703,25 @@ var PostgresClient = class {
|
|
|
604
703
|
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
605
704
|
return resp;
|
|
606
705
|
}
|
|
706
|
+
/** Gets a migration assessment run. */
|
|
707
|
+
async getAssessment(req, options) {
|
|
708
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
709
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ""}`;
|
|
710
|
+
let resp;
|
|
711
|
+
const call = async (callSignal) => {
|
|
712
|
+
const headers = new Headers();
|
|
713
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
714
|
+
headers.set("User-Agent", this.userAgent);
|
|
715
|
+
resp = parseResponse(await executeHttpCall({
|
|
716
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
717
|
+
httpClient,
|
|
718
|
+
logger: this.logger
|
|
719
|
+
}), unmarshalAssessmentSchema);
|
|
720
|
+
};
|
|
721
|
+
await executeCall(call, options);
|
|
722
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
723
|
+
return resp;
|
|
724
|
+
}
|
|
607
725
|
/** Retrieves information about the specified database branch. */
|
|
608
726
|
async getBranch(req, options) {
|
|
609
727
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
@@ -743,6 +861,25 @@ var PostgresClient = class {
|
|
|
743
861
|
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
744
862
|
return resp;
|
|
745
863
|
}
|
|
864
|
+
/** Gets a migration. */
|
|
865
|
+
async getMigration(req, options) {
|
|
866
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
867
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ""}`;
|
|
868
|
+
let resp;
|
|
869
|
+
const call = async (callSignal) => {
|
|
870
|
+
const headers = new Headers();
|
|
871
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
872
|
+
headers.set("User-Agent", this.userAgent);
|
|
873
|
+
resp = parseResponse(await executeHttpCall({
|
|
874
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
875
|
+
httpClient,
|
|
876
|
+
logger: this.logger
|
|
877
|
+
}), unmarshalMigrationSchema);
|
|
878
|
+
};
|
|
879
|
+
await executeCall(call, options);
|
|
880
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
881
|
+
return resp;
|
|
882
|
+
}
|
|
746
883
|
/** Retrieves the status of a long-running operation. */
|
|
747
884
|
async getOperation(req, options) {
|
|
748
885
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
@@ -860,6 +997,39 @@ var PostgresClient = class {
|
|
|
860
997
|
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
861
998
|
return resp;
|
|
862
999
|
}
|
|
1000
|
+
/** Lists assessment runs for a migration. */
|
|
1001
|
+
async listAssessments(req, options) {
|
|
1002
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1003
|
+
const url = `${host}/api/2.0/postgres/${req.parent ?? ""}/assessments`;
|
|
1004
|
+
const params = new URLSearchParams();
|
|
1005
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
1006
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
1007
|
+
const query = params.toString();
|
|
1008
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
1009
|
+
let resp;
|
|
1010
|
+
const call = async (callSignal) => {
|
|
1011
|
+
const headers = new Headers();
|
|
1012
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
1013
|
+
headers.set("User-Agent", this.userAgent);
|
|
1014
|
+
resp = parseResponse(await executeHttpCall({
|
|
1015
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
1016
|
+
httpClient,
|
|
1017
|
+
logger: this.logger
|
|
1018
|
+
}), unmarshalListAssessmentsResponseSchema);
|
|
1019
|
+
};
|
|
1020
|
+
await executeCall(call, options);
|
|
1021
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
1022
|
+
return resp;
|
|
1023
|
+
}
|
|
1024
|
+
async *listAssessmentsIter(req, options) {
|
|
1025
|
+
const pageReq = { ...req };
|
|
1026
|
+
for (;;) {
|
|
1027
|
+
const resp = await this.listAssessments(pageReq, options);
|
|
1028
|
+
for (const item of resp.assessments ?? []) yield item;
|
|
1029
|
+
if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
|
|
1030
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
863
1033
|
/** Returns a paginated list of database branches in the project. */
|
|
864
1034
|
async listBranches(req, options) {
|
|
865
1035
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
@@ -1034,6 +1204,40 @@ var PostgresClient = class {
|
|
|
1034
1204
|
pageReq.pageToken = resp.nextPageToken;
|
|
1035
1205
|
}
|
|
1036
1206
|
}
|
|
1207
|
+
/** Lists migrations in the workspace. */
|
|
1208
|
+
async listMigrations(req, options) {
|
|
1209
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1210
|
+
const url = `${host}/api/2.0/postgres/migrations`;
|
|
1211
|
+
const params = new URLSearchParams();
|
|
1212
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
1213
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
1214
|
+
if (req.showDeleted !== void 0) params.append("show_deleted", String(req.showDeleted));
|
|
1215
|
+
const query = params.toString();
|
|
1216
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
1217
|
+
let resp;
|
|
1218
|
+
const call = async (callSignal) => {
|
|
1219
|
+
const headers = new Headers();
|
|
1220
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
1221
|
+
headers.set("User-Agent", this.userAgent);
|
|
1222
|
+
resp = parseResponse(await executeHttpCall({
|
|
1223
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
1224
|
+
httpClient,
|
|
1225
|
+
logger: this.logger
|
|
1226
|
+
}), unmarshalListMigrationsResponseSchema);
|
|
1227
|
+
};
|
|
1228
|
+
await executeCall(call, options);
|
|
1229
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
1230
|
+
return resp;
|
|
1231
|
+
}
|
|
1232
|
+
async *listMigrationsIter(req, options) {
|
|
1233
|
+
const pageReq = { ...req };
|
|
1234
|
+
for (;;) {
|
|
1235
|
+
const resp = await this.listMigrations(pageReq, options);
|
|
1236
|
+
for (const item of resp.migrations ?? []) yield item;
|
|
1237
|
+
if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
|
|
1238
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1037
1241
|
/** Returns a paginated list of database projects in the workspace that the user has permission to access. */
|
|
1038
1242
|
async listProjects(req, options) {
|
|
1039
1243
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
@@ -1154,6 +1358,38 @@ var PostgresClient = class {
|
|
|
1154
1358
|
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
1155
1359
|
return resp;
|
|
1156
1360
|
}
|
|
1361
|
+
/**
|
|
1362
|
+
* Starts the assessed migration named in the request, moving it from READY_TO_START into
|
|
1363
|
+
* execution. Its first phase, SCHEMA_LOAD, creates the target databases, roles, and schema on the
|
|
1364
|
+
* migration's target Lakebase branch without copying any table data, ahead of INITIAL_DATA_LOAD.
|
|
1365
|
+
*/
|
|
1366
|
+
async startMigrationBase(req, options) {
|
|
1367
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1368
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ""}/start`;
|
|
1369
|
+
const body = marshalRequest(req, marshalStartMigrationRequestSchema);
|
|
1370
|
+
let resp;
|
|
1371
|
+
const call = async (callSignal) => {
|
|
1372
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
1373
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
1374
|
+
headers.set("User-Agent", this.userAgent);
|
|
1375
|
+
resp = parseResponse(await executeHttpCall({
|
|
1376
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
1377
|
+
httpClient,
|
|
1378
|
+
logger: this.logger
|
|
1379
|
+
}), unmarshalOperationSchema);
|
|
1380
|
+
};
|
|
1381
|
+
await executeCall(call, options);
|
|
1382
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
1383
|
+
return resp;
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Starts the assessed migration named in the request, moving it from READY_TO_START into
|
|
1387
|
+
* execution. Its first phase, SCHEMA_LOAD, creates the target databases, roles, and schema on the
|
|
1388
|
+
* migration's target Lakebase branch without copying any table data, ahead of INITIAL_DATA_LOAD.
|
|
1389
|
+
*/
|
|
1390
|
+
async startMigration(req, options) {
|
|
1391
|
+
return new StartMigrationOperation(await this.startMigrationBase(req, options), (req, options) => this.getOperation(req, options));
|
|
1392
|
+
}
|
|
1157
1393
|
/** Undeletes the specified database branch. */
|
|
1158
1394
|
async undeleteBranchBase(req, options) {
|
|
1159
1395
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
@@ -1178,6 +1414,30 @@ var PostgresClient = class {
|
|
|
1178
1414
|
async undeleteBranch(req, options) {
|
|
1179
1415
|
return new UndeleteBranchOperation(await this.undeleteBranchBase(req, options), (req, options) => this.getOperation(req, options));
|
|
1180
1416
|
}
|
|
1417
|
+
/** Restores a soft-deleted migration before it is permanently purged. */
|
|
1418
|
+
async undeleteMigrationBase(req, options) {
|
|
1419
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1420
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ""}/undelete`;
|
|
1421
|
+
const body = marshalRequest(req, marshalUndeleteMigrationRequestSchema);
|
|
1422
|
+
let resp;
|
|
1423
|
+
const call = async (callSignal) => {
|
|
1424
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
1425
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
1426
|
+
headers.set("User-Agent", this.userAgent);
|
|
1427
|
+
resp = parseResponse(await executeHttpCall({
|
|
1428
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
1429
|
+
httpClient,
|
|
1430
|
+
logger: this.logger
|
|
1431
|
+
}), unmarshalOperationSchema);
|
|
1432
|
+
};
|
|
1433
|
+
await executeCall(call, options);
|
|
1434
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
1435
|
+
return resp;
|
|
1436
|
+
}
|
|
1437
|
+
/** Restores a soft-deleted migration before it is permanently purged. */
|
|
1438
|
+
async undeleteMigration(req, options) {
|
|
1439
|
+
return new UndeleteMigrationOperation(await this.undeleteMigrationBase(req, options), (req, options) => this.getOperation(req, options));
|
|
1440
|
+
}
|
|
1181
1441
|
/** Undeletes a soft-deleted project. */
|
|
1182
1442
|
async undeleteProjectBase(req, options) {
|
|
1183
1443
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
@@ -1314,6 +1574,34 @@ var PostgresClient = class {
|
|
|
1314
1574
|
async updateEndpoint(req, options) {
|
|
1315
1575
|
return new UpdateEndpointOperation(await this.updateEndpointBase(req, options), (req, options) => this.getOperation(req, options));
|
|
1316
1576
|
}
|
|
1577
|
+
/** Updates user-owned migration configuration. */
|
|
1578
|
+
async updateMigrationBase(req, options) {
|
|
1579
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1580
|
+
const url = `${host}/api/2.0/postgres/${req.migration?.name ?? ""}`;
|
|
1581
|
+
const params = new URLSearchParams();
|
|
1582
|
+
if (req.updateMask !== void 0) params.append("update_mask", req.updateMask.toString());
|
|
1583
|
+
const query = params.toString();
|
|
1584
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
1585
|
+
const body = marshalRequest(req.migration, marshalMigrationSchema);
|
|
1586
|
+
let resp;
|
|
1587
|
+
const call = async (callSignal) => {
|
|
1588
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
1589
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
1590
|
+
headers.set("User-Agent", this.userAgent);
|
|
1591
|
+
resp = parseResponse(await executeHttpCall({
|
|
1592
|
+
request: buildHttpRequest("PATCH", fullUrl, headers, callSignal, body),
|
|
1593
|
+
httpClient,
|
|
1594
|
+
logger: this.logger
|
|
1595
|
+
}), unmarshalOperationSchema);
|
|
1596
|
+
};
|
|
1597
|
+
await executeCall(call, options);
|
|
1598
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
1599
|
+
return resp;
|
|
1600
|
+
}
|
|
1601
|
+
/** Updates user-owned migration configuration. */
|
|
1602
|
+
async updateMigration(req, options) {
|
|
1603
|
+
return new UpdateMigrationOperation(await this.updateMigrationBase(req, options), (req, options) => this.getOperation(req, options));
|
|
1604
|
+
}
|
|
1317
1605
|
/** Updates the specified database project. */
|
|
1318
1606
|
async updateProjectBase(req, options) {
|
|
1319
1607
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
@@ -1342,7 +1630,15 @@ var PostgresClient = class {
|
|
|
1342
1630
|
async updateProject(req, options) {
|
|
1343
1631
|
return new UpdateProjectOperation(await this.updateProjectBase(req, options), (req, options) => this.getOperation(req, options));
|
|
1344
1632
|
}
|
|
1345
|
-
/**
|
|
1633
|
+
/**
|
|
1634
|
+
* Updates the mutable fields of a Postgres role for a branch.
|
|
1635
|
+
*
|
|
1636
|
+
* The fields `spec.identity_type`, `spec.auth_method`, and
|
|
1637
|
+
* `spec.postgres_role` are fixed when the role is created. UpdateRole
|
|
1638
|
+
* ignores values supplied for these fields in the request body and
|
|
1639
|
+
* retains their existing values. Explicitly naming one of these fields
|
|
1640
|
+
* in `update_mask` returns an INVALID_PARAMETER_VALUE error.
|
|
1641
|
+
*/
|
|
1346
1642
|
async updateRoleBase(req, options) {
|
|
1347
1643
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1348
1644
|
const url = `${host}/api/2.0/postgres/${req.role?.name ?? ""}`;
|
|
@@ -1366,7 +1662,15 @@ var PostgresClient = class {
|
|
|
1366
1662
|
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
1367
1663
|
return resp;
|
|
1368
1664
|
}
|
|
1369
|
-
/**
|
|
1665
|
+
/**
|
|
1666
|
+
* Updates the mutable fields of a Postgres role for a branch.
|
|
1667
|
+
*
|
|
1668
|
+
* The fields `spec.identity_type`, `spec.auth_method`, and
|
|
1669
|
+
* `spec.postgres_role` are fixed when the role is created. UpdateRole
|
|
1670
|
+
* ignores values supplied for these fields in the request body and
|
|
1671
|
+
* retains their existing values. Explicitly naming one of these fields
|
|
1672
|
+
* in `update_mask` returns an INVALID_PARAMETER_VALUE error.
|
|
1673
|
+
*/
|
|
1370
1674
|
async updateRole(req, options) {
|
|
1371
1675
|
return new UpdateRoleOperation(await this.updateRoleBase(req, options), (req, options) => this.getOperation(req, options));
|
|
1372
1676
|
}
|
|
@@ -1405,7 +1709,7 @@ var PostgresClient = class {
|
|
|
1405
1709
|
return new UpdateSnapshotScheduleOperation(await this.updateSnapshotScheduleBase(req, options), (req, options) => this.getOperation(req, options));
|
|
1406
1710
|
}
|
|
1407
1711
|
};
|
|
1408
|
-
var
|
|
1712
|
+
var AcknowledgeAssessmentWarningsOperation = class {
|
|
1409
1713
|
constructor(operation, getOperation) {
|
|
1410
1714
|
this.operation = operation;
|
|
1411
1715
|
this.getOperation = getOperation;
|
|
@@ -1417,7 +1721,7 @@ var CreateBranchOperation = class {
|
|
|
1417
1721
|
/** Returns metadata associated with the long-running operation. */
|
|
1418
1722
|
metadata() {
|
|
1419
1723
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1420
|
-
return Promise.resolve(z.lazy(() =>
|
|
1724
|
+
return Promise.resolve(z.lazy(() => unmarshalMigrationOperationMetadataSchema).parse(this.operation.metadata));
|
|
1421
1725
|
}
|
|
1422
1726
|
/**
|
|
1423
1727
|
* Polls the operation until it completes.
|
|
@@ -1438,7 +1742,7 @@ var CreateBranchOperation = class {
|
|
|
1438
1742
|
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
1439
1743
|
}
|
|
1440
1744
|
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
1441
|
-
result = z.lazy(() =>
|
|
1745
|
+
result = z.lazy(() => unmarshalAcknowledgeAssessmentWarningsResponseSchema).parse(op.result.response);
|
|
1442
1746
|
};
|
|
1443
1747
|
await executeWait(call, options);
|
|
1444
1748
|
if (result === void 0) throw new Error("operation completed without a result.");
|
|
@@ -1451,7 +1755,7 @@ var CreateBranchOperation = class {
|
|
|
1451
1755
|
return op.done;
|
|
1452
1756
|
}
|
|
1453
1757
|
};
|
|
1454
|
-
var
|
|
1758
|
+
var AssessMigrationOperation = class {
|
|
1455
1759
|
constructor(operation, getOperation) {
|
|
1456
1760
|
this.operation = operation;
|
|
1457
1761
|
this.getOperation = getOperation;
|
|
@@ -1463,7 +1767,7 @@ var CreateCatalogOperation = class {
|
|
|
1463
1767
|
/** Returns metadata associated with the long-running operation. */
|
|
1464
1768
|
metadata() {
|
|
1465
1769
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1466
|
-
return Promise.resolve(z.lazy(() =>
|
|
1770
|
+
return Promise.resolve(z.lazy(() => unmarshalMigrationOperationMetadataSchema).parse(this.operation.metadata));
|
|
1467
1771
|
}
|
|
1468
1772
|
/**
|
|
1469
1773
|
* Polls the operation until it completes.
|
|
@@ -1484,7 +1788,7 @@ var CreateCatalogOperation = class {
|
|
|
1484
1788
|
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
1485
1789
|
}
|
|
1486
1790
|
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
1487
|
-
result = z.lazy(() =>
|
|
1791
|
+
result = z.lazy(() => unmarshalAssessMigrationResponseSchema).parse(op.result.response);
|
|
1488
1792
|
};
|
|
1489
1793
|
await executeWait(call, options);
|
|
1490
1794
|
if (result === void 0) throw new Error("operation completed without a result.");
|
|
@@ -1497,7 +1801,7 @@ var CreateCatalogOperation = class {
|
|
|
1497
1801
|
return op.done;
|
|
1498
1802
|
}
|
|
1499
1803
|
};
|
|
1500
|
-
var
|
|
1804
|
+
var CreateBranchOperation = class {
|
|
1501
1805
|
constructor(operation, getOperation) {
|
|
1502
1806
|
this.operation = operation;
|
|
1503
1807
|
this.getOperation = getOperation;
|
|
@@ -1509,7 +1813,7 @@ var CreateCdfConfigOperation = class {
|
|
|
1509
1813
|
/** Returns metadata associated with the long-running operation. */
|
|
1510
1814
|
metadata() {
|
|
1511
1815
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1512
|
-
return Promise.resolve(z.lazy(() =>
|
|
1816
|
+
return Promise.resolve(z.lazy(() => unmarshalBranchOperationMetadataSchema).parse(this.operation.metadata));
|
|
1513
1817
|
}
|
|
1514
1818
|
/**
|
|
1515
1819
|
* Polls the operation until it completes.
|
|
@@ -1530,7 +1834,7 @@ var CreateCdfConfigOperation = class {
|
|
|
1530
1834
|
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
1531
1835
|
}
|
|
1532
1836
|
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
1533
|
-
result = z.lazy(() =>
|
|
1837
|
+
result = z.lazy(() => unmarshalBranchSchema).parse(op.result.response);
|
|
1534
1838
|
};
|
|
1535
1839
|
await executeWait(call, options);
|
|
1536
1840
|
if (result === void 0) throw new Error("operation completed without a result.");
|
|
@@ -1543,7 +1847,7 @@ var CreateCdfConfigOperation = class {
|
|
|
1543
1847
|
return op.done;
|
|
1544
1848
|
}
|
|
1545
1849
|
};
|
|
1546
|
-
var
|
|
1850
|
+
var CreateCatalogOperation = class {
|
|
1547
1851
|
constructor(operation, getOperation) {
|
|
1548
1852
|
this.operation = operation;
|
|
1549
1853
|
this.getOperation = getOperation;
|
|
@@ -1555,7 +1859,7 @@ var CreateDataApiOperation = class {
|
|
|
1555
1859
|
/** Returns metadata associated with the long-running operation. */
|
|
1556
1860
|
metadata() {
|
|
1557
1861
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1558
|
-
return Promise.resolve(z.lazy(() =>
|
|
1862
|
+
return Promise.resolve(z.lazy(() => unmarshalCatalogOperationMetadataSchema).parse(this.operation.metadata));
|
|
1559
1863
|
}
|
|
1560
1864
|
/**
|
|
1561
1865
|
* Polls the operation until it completes.
|
|
@@ -1576,7 +1880,7 @@ var CreateDataApiOperation = class {
|
|
|
1576
1880
|
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
1577
1881
|
}
|
|
1578
1882
|
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
1579
|
-
result = z.lazy(() =>
|
|
1883
|
+
result = z.lazy(() => unmarshalCatalogSchema).parse(op.result.response);
|
|
1580
1884
|
};
|
|
1581
1885
|
await executeWait(call, options);
|
|
1582
1886
|
if (result === void 0) throw new Error("operation completed without a result.");
|
|
@@ -1589,7 +1893,7 @@ var CreateDataApiOperation = class {
|
|
|
1589
1893
|
return op.done;
|
|
1590
1894
|
}
|
|
1591
1895
|
};
|
|
1592
|
-
var
|
|
1896
|
+
var CreateCdfConfigOperation = class {
|
|
1593
1897
|
constructor(operation, getOperation) {
|
|
1594
1898
|
this.operation = operation;
|
|
1595
1899
|
this.getOperation = getOperation;
|
|
@@ -1601,7 +1905,7 @@ var CreateDatabaseOperation = class {
|
|
|
1601
1905
|
/** Returns metadata associated with the long-running operation. */
|
|
1602
1906
|
metadata() {
|
|
1603
1907
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1604
|
-
return Promise.resolve(z.lazy(() =>
|
|
1908
|
+
return Promise.resolve(z.lazy(() => unmarshalCdfConfigOperationMetadataSchema).parse(this.operation.metadata));
|
|
1605
1909
|
}
|
|
1606
1910
|
/**
|
|
1607
1911
|
* Polls the operation until it completes.
|
|
@@ -1622,7 +1926,7 @@ var CreateDatabaseOperation = class {
|
|
|
1622
1926
|
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
1623
1927
|
}
|
|
1624
1928
|
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
1625
|
-
result = z.lazy(() =>
|
|
1929
|
+
result = z.lazy(() => unmarshalCdfConfigSchema).parse(op.result.response);
|
|
1626
1930
|
};
|
|
1627
1931
|
await executeWait(call, options);
|
|
1628
1932
|
if (result === void 0) throw new Error("operation completed without a result.");
|
|
@@ -1635,7 +1939,7 @@ var CreateDatabaseOperation = class {
|
|
|
1635
1939
|
return op.done;
|
|
1636
1940
|
}
|
|
1637
1941
|
};
|
|
1638
|
-
var
|
|
1942
|
+
var CreateDataApiOperation = class {
|
|
1639
1943
|
constructor(operation, getOperation) {
|
|
1640
1944
|
this.operation = operation;
|
|
1641
1945
|
this.getOperation = getOperation;
|
|
@@ -1647,7 +1951,7 @@ var CreateEndpointOperation = class {
|
|
|
1647
1951
|
/** Returns metadata associated with the long-running operation. */
|
|
1648
1952
|
metadata() {
|
|
1649
1953
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1650
|
-
return Promise.resolve(z.lazy(() =>
|
|
1954
|
+
return Promise.resolve(z.lazy(() => unmarshalDataApiOperationMetadataSchema).parse(this.operation.metadata));
|
|
1651
1955
|
}
|
|
1652
1956
|
/**
|
|
1653
1957
|
* Polls the operation until it completes.
|
|
@@ -1668,7 +1972,7 @@ var CreateEndpointOperation = class {
|
|
|
1668
1972
|
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
1669
1973
|
}
|
|
1670
1974
|
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
1671
|
-
result = z.lazy(() =>
|
|
1975
|
+
result = z.lazy(() => unmarshalDataApiSchema).parse(op.result.response);
|
|
1672
1976
|
};
|
|
1673
1977
|
await executeWait(call, options);
|
|
1674
1978
|
if (result === void 0) throw new Error("operation completed without a result.");
|
|
@@ -1681,7 +1985,7 @@ var CreateEndpointOperation = class {
|
|
|
1681
1985
|
return op.done;
|
|
1682
1986
|
}
|
|
1683
1987
|
};
|
|
1684
|
-
var
|
|
1988
|
+
var CreateDatabaseOperation = class {
|
|
1685
1989
|
constructor(operation, getOperation) {
|
|
1686
1990
|
this.operation = operation;
|
|
1687
1991
|
this.getOperation = getOperation;
|
|
@@ -1693,7 +1997,145 @@ var CreateProjectOperation = class {
|
|
|
1693
1997
|
/** Returns metadata associated with the long-running operation. */
|
|
1694
1998
|
metadata() {
|
|
1695
1999
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1696
|
-
return Promise.resolve(z.lazy(() =>
|
|
2000
|
+
return Promise.resolve(z.lazy(() => unmarshalDatabaseOperationMetadataSchema).parse(this.operation.metadata));
|
|
2001
|
+
}
|
|
2002
|
+
/**
|
|
2003
|
+
* Polls the operation until it completes.
|
|
2004
|
+
*
|
|
2005
|
+
* Throws if the operation failed.
|
|
2006
|
+
*/
|
|
2007
|
+
async wait(options) {
|
|
2008
|
+
let result;
|
|
2009
|
+
const call = async (callSignal) => {
|
|
2010
|
+
const op = await this.getOperation({ name: this.operation.name }, callSignal !== void 0 ? { signal: callSignal } : void 0);
|
|
2011
|
+
this.operation = op;
|
|
2012
|
+
if (op.done === void 0) throw new Error("operation is missing the done field");
|
|
2013
|
+
if (!op.done) throw new StillRunningError();
|
|
2014
|
+
if (op.result?.$case === "error") {
|
|
2015
|
+
const err = op.result.error;
|
|
2016
|
+
const msg = err.message !== void 0 && err.message !== "" ? err.message : "unknown error";
|
|
2017
|
+
const errorMsg = err.errorCode !== void 0 ? `[${err.errorCode}] ${msg}` : msg;
|
|
2018
|
+
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
2019
|
+
}
|
|
2020
|
+
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
2021
|
+
result = z.lazy(() => unmarshalDatabaseSchema).parse(op.result.response);
|
|
2022
|
+
};
|
|
2023
|
+
await executeWait(call, options);
|
|
2024
|
+
if (result === void 0) throw new Error("operation completed without a result.");
|
|
2025
|
+
return result;
|
|
2026
|
+
}
|
|
2027
|
+
/** Checks whether the operation has completed */
|
|
2028
|
+
async done(options) {
|
|
2029
|
+
const op = await this.getOperation({ name: this.operation.name }, options);
|
|
2030
|
+
this.operation = op;
|
|
2031
|
+
return op.done;
|
|
2032
|
+
}
|
|
2033
|
+
};
|
|
2034
|
+
var CreateEndpointOperation = class {
|
|
2035
|
+
constructor(operation, getOperation) {
|
|
2036
|
+
this.operation = operation;
|
|
2037
|
+
this.getOperation = getOperation;
|
|
2038
|
+
}
|
|
2039
|
+
/** Returns the server-assigned name of the long-running operation. */
|
|
2040
|
+
name() {
|
|
2041
|
+
return Promise.resolve(this.operation.name);
|
|
2042
|
+
}
|
|
2043
|
+
/** Returns metadata associated with the long-running operation. */
|
|
2044
|
+
metadata() {
|
|
2045
|
+
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
2046
|
+
return Promise.resolve(z.lazy(() => unmarshalEndpointOperationMetadataSchema).parse(this.operation.metadata));
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* Polls the operation until it completes.
|
|
2050
|
+
*
|
|
2051
|
+
* Throws if the operation failed.
|
|
2052
|
+
*/
|
|
2053
|
+
async wait(options) {
|
|
2054
|
+
let result;
|
|
2055
|
+
const call = async (callSignal) => {
|
|
2056
|
+
const op = await this.getOperation({ name: this.operation.name }, callSignal !== void 0 ? { signal: callSignal } : void 0);
|
|
2057
|
+
this.operation = op;
|
|
2058
|
+
if (op.done === void 0) throw new Error("operation is missing the done field");
|
|
2059
|
+
if (!op.done) throw new StillRunningError();
|
|
2060
|
+
if (op.result?.$case === "error") {
|
|
2061
|
+
const err = op.result.error;
|
|
2062
|
+
const msg = err.message !== void 0 && err.message !== "" ? err.message : "unknown error";
|
|
2063
|
+
const errorMsg = err.errorCode !== void 0 ? `[${err.errorCode}] ${msg}` : msg;
|
|
2064
|
+
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
2065
|
+
}
|
|
2066
|
+
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
2067
|
+
result = z.lazy(() => unmarshalEndpointSchema).parse(op.result.response);
|
|
2068
|
+
};
|
|
2069
|
+
await executeWait(call, options);
|
|
2070
|
+
if (result === void 0) throw new Error("operation completed without a result.");
|
|
2071
|
+
return result;
|
|
2072
|
+
}
|
|
2073
|
+
/** Checks whether the operation has completed */
|
|
2074
|
+
async done(options) {
|
|
2075
|
+
const op = await this.getOperation({ name: this.operation.name }, options);
|
|
2076
|
+
this.operation = op;
|
|
2077
|
+
return op.done;
|
|
2078
|
+
}
|
|
2079
|
+
};
|
|
2080
|
+
var CreateMigrationOperation = class {
|
|
2081
|
+
constructor(operation, getOperation) {
|
|
2082
|
+
this.operation = operation;
|
|
2083
|
+
this.getOperation = getOperation;
|
|
2084
|
+
}
|
|
2085
|
+
/** Returns the server-assigned name of the long-running operation. */
|
|
2086
|
+
name() {
|
|
2087
|
+
return Promise.resolve(this.operation.name);
|
|
2088
|
+
}
|
|
2089
|
+
/** Returns metadata associated with the long-running operation. */
|
|
2090
|
+
metadata() {
|
|
2091
|
+
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
2092
|
+
return Promise.resolve(z.lazy(() => unmarshalMigrationOperationMetadataSchema).parse(this.operation.metadata));
|
|
2093
|
+
}
|
|
2094
|
+
/**
|
|
2095
|
+
* Polls the operation until it completes.
|
|
2096
|
+
*
|
|
2097
|
+
* Throws if the operation failed.
|
|
2098
|
+
*/
|
|
2099
|
+
async wait(options) {
|
|
2100
|
+
let result;
|
|
2101
|
+
const call = async (callSignal) => {
|
|
2102
|
+
const op = await this.getOperation({ name: this.operation.name }, callSignal !== void 0 ? { signal: callSignal } : void 0);
|
|
2103
|
+
this.operation = op;
|
|
2104
|
+
if (op.done === void 0) throw new Error("operation is missing the done field");
|
|
2105
|
+
if (!op.done) throw new StillRunningError();
|
|
2106
|
+
if (op.result?.$case === "error") {
|
|
2107
|
+
const err = op.result.error;
|
|
2108
|
+
const msg = err.message !== void 0 && err.message !== "" ? err.message : "unknown error";
|
|
2109
|
+
const errorMsg = err.errorCode !== void 0 ? `[${err.errorCode}] ${msg}` : msg;
|
|
2110
|
+
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
2111
|
+
}
|
|
2112
|
+
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
2113
|
+
result = z.lazy(() => unmarshalMigrationSchema).parse(op.result.response);
|
|
2114
|
+
};
|
|
2115
|
+
await executeWait(call, options);
|
|
2116
|
+
if (result === void 0) throw new Error("operation completed without a result.");
|
|
2117
|
+
return result;
|
|
2118
|
+
}
|
|
2119
|
+
/** Checks whether the operation has completed */
|
|
2120
|
+
async done(options) {
|
|
2121
|
+
const op = await this.getOperation({ name: this.operation.name }, options);
|
|
2122
|
+
this.operation = op;
|
|
2123
|
+
return op.done;
|
|
2124
|
+
}
|
|
2125
|
+
};
|
|
2126
|
+
var CreateProjectOperation = class {
|
|
2127
|
+
constructor(operation, getOperation) {
|
|
2128
|
+
this.operation = operation;
|
|
2129
|
+
this.getOperation = getOperation;
|
|
2130
|
+
}
|
|
2131
|
+
/** Returns the server-assigned name of the long-running operation. */
|
|
2132
|
+
name() {
|
|
2133
|
+
return Promise.resolve(this.operation.name);
|
|
2134
|
+
}
|
|
2135
|
+
/** Returns metadata associated with the long-running operation. */
|
|
2136
|
+
metadata() {
|
|
2137
|
+
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
2138
|
+
return Promise.resolve(z.lazy(() => unmarshalProjectOperationMetadataSchema).parse(this.operation.metadata));
|
|
1697
2139
|
}
|
|
1698
2140
|
/**
|
|
1699
2141
|
* Polls the operation until it completes.
|
|
@@ -2111,6 +2553,52 @@ var DeleteEndpointOperation = class {
|
|
|
2111
2553
|
return op.done;
|
|
2112
2554
|
}
|
|
2113
2555
|
};
|
|
2556
|
+
var DeleteMigrationOperation = class {
|
|
2557
|
+
constructor(operation, getOperation) {
|
|
2558
|
+
this.operation = operation;
|
|
2559
|
+
this.getOperation = getOperation;
|
|
2560
|
+
}
|
|
2561
|
+
/** Returns the server-assigned name of the long-running operation. */
|
|
2562
|
+
name() {
|
|
2563
|
+
return Promise.resolve(this.operation.name);
|
|
2564
|
+
}
|
|
2565
|
+
/** Returns metadata associated with the long-running operation. */
|
|
2566
|
+
metadata() {
|
|
2567
|
+
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
2568
|
+
return Promise.resolve(z.lazy(() => unmarshalMigrationOperationMetadataSchema).parse(this.operation.metadata));
|
|
2569
|
+
}
|
|
2570
|
+
/**
|
|
2571
|
+
* Polls the operation until it completes.
|
|
2572
|
+
*
|
|
2573
|
+
* Throws if the operation failed.
|
|
2574
|
+
*/
|
|
2575
|
+
async wait(options) {
|
|
2576
|
+
let result;
|
|
2577
|
+
const call = async (callSignal) => {
|
|
2578
|
+
const op = await this.getOperation({ name: this.operation.name }, callSignal !== void 0 ? { signal: callSignal } : void 0);
|
|
2579
|
+
this.operation = op;
|
|
2580
|
+
if (op.done === void 0) throw new Error("operation is missing the done field");
|
|
2581
|
+
if (!op.done) throw new StillRunningError();
|
|
2582
|
+
if (op.result?.$case === "error") {
|
|
2583
|
+
const err = op.result.error;
|
|
2584
|
+
const msg = err.message !== void 0 && err.message !== "" ? err.message : "unknown error";
|
|
2585
|
+
const errorMsg = err.errorCode !== void 0 ? `[${err.errorCode}] ${msg}` : msg;
|
|
2586
|
+
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
2587
|
+
}
|
|
2588
|
+
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
2589
|
+
result = z.lazy(() => unmarshalMigrationSchema).parse(op.result.response);
|
|
2590
|
+
};
|
|
2591
|
+
await executeWait(call, options);
|
|
2592
|
+
if (result === void 0) throw new Error("operation completed without a result.");
|
|
2593
|
+
return result;
|
|
2594
|
+
}
|
|
2595
|
+
/** Checks whether the operation has completed */
|
|
2596
|
+
async done(options) {
|
|
2597
|
+
const op = await this.getOperation({ name: this.operation.name }, options);
|
|
2598
|
+
this.operation = op;
|
|
2599
|
+
return op.done;
|
|
2600
|
+
}
|
|
2601
|
+
};
|
|
2114
2602
|
var DeleteProjectOperation = class {
|
|
2115
2603
|
constructor(operation, getOperation) {
|
|
2116
2604
|
this.operation = operation;
|
|
@@ -2275,6 +2763,52 @@ var DeleteSyncedTableOperation = class {
|
|
|
2275
2763
|
return op.done;
|
|
2276
2764
|
}
|
|
2277
2765
|
};
|
|
2766
|
+
var StartMigrationOperation = class {
|
|
2767
|
+
constructor(operation, getOperation) {
|
|
2768
|
+
this.operation = operation;
|
|
2769
|
+
this.getOperation = getOperation;
|
|
2770
|
+
}
|
|
2771
|
+
/** Returns the server-assigned name of the long-running operation. */
|
|
2772
|
+
name() {
|
|
2773
|
+
return Promise.resolve(this.operation.name);
|
|
2774
|
+
}
|
|
2775
|
+
/** Returns metadata associated with the long-running operation. */
|
|
2776
|
+
metadata() {
|
|
2777
|
+
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
2778
|
+
return Promise.resolve(z.lazy(() => unmarshalMigrationOperationMetadataSchema).parse(this.operation.metadata));
|
|
2779
|
+
}
|
|
2780
|
+
/**
|
|
2781
|
+
* Polls the operation until it completes.
|
|
2782
|
+
*
|
|
2783
|
+
* Throws if the operation failed.
|
|
2784
|
+
*/
|
|
2785
|
+
async wait(options) {
|
|
2786
|
+
let result;
|
|
2787
|
+
const call = async (callSignal) => {
|
|
2788
|
+
const op = await this.getOperation({ name: this.operation.name }, callSignal !== void 0 ? { signal: callSignal } : void 0);
|
|
2789
|
+
this.operation = op;
|
|
2790
|
+
if (op.done === void 0) throw new Error("operation is missing the done field");
|
|
2791
|
+
if (!op.done) throw new StillRunningError();
|
|
2792
|
+
if (op.result?.$case === "error") {
|
|
2793
|
+
const err = op.result.error;
|
|
2794
|
+
const msg = err.message !== void 0 && err.message !== "" ? err.message : "unknown error";
|
|
2795
|
+
const errorMsg = err.errorCode !== void 0 ? `[${err.errorCode}] ${msg}` : msg;
|
|
2796
|
+
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
2797
|
+
}
|
|
2798
|
+
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
2799
|
+
result = z.lazy(() => unmarshalStartMigrationResponseSchema).parse(op.result.response);
|
|
2800
|
+
};
|
|
2801
|
+
await executeWait(call, options);
|
|
2802
|
+
if (result === void 0) throw new Error("operation completed without a result.");
|
|
2803
|
+
return result;
|
|
2804
|
+
}
|
|
2805
|
+
/** Checks whether the operation has completed */
|
|
2806
|
+
async done(options) {
|
|
2807
|
+
const op = await this.getOperation({ name: this.operation.name }, options);
|
|
2808
|
+
this.operation = op;
|
|
2809
|
+
return op.done;
|
|
2810
|
+
}
|
|
2811
|
+
};
|
|
2278
2812
|
var UndeleteBranchOperation = class {
|
|
2279
2813
|
constructor(operation, getOperation) {
|
|
2280
2814
|
this.operation = operation;
|
|
@@ -2316,6 +2850,52 @@ var UndeleteBranchOperation = class {
|
|
|
2316
2850
|
return op.done;
|
|
2317
2851
|
}
|
|
2318
2852
|
};
|
|
2853
|
+
var UndeleteMigrationOperation = class {
|
|
2854
|
+
constructor(operation, getOperation) {
|
|
2855
|
+
this.operation = operation;
|
|
2856
|
+
this.getOperation = getOperation;
|
|
2857
|
+
}
|
|
2858
|
+
/** Returns the server-assigned name of the long-running operation. */
|
|
2859
|
+
name() {
|
|
2860
|
+
return Promise.resolve(this.operation.name);
|
|
2861
|
+
}
|
|
2862
|
+
/** Returns metadata associated with the long-running operation. */
|
|
2863
|
+
metadata() {
|
|
2864
|
+
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
2865
|
+
return Promise.resolve(z.lazy(() => unmarshalMigrationOperationMetadataSchema).parse(this.operation.metadata));
|
|
2866
|
+
}
|
|
2867
|
+
/**
|
|
2868
|
+
* Polls the operation until it completes.
|
|
2869
|
+
*
|
|
2870
|
+
* Throws if the operation failed.
|
|
2871
|
+
*/
|
|
2872
|
+
async wait(options) {
|
|
2873
|
+
let result;
|
|
2874
|
+
const call = async (callSignal) => {
|
|
2875
|
+
const op = await this.getOperation({ name: this.operation.name }, callSignal !== void 0 ? { signal: callSignal } : void 0);
|
|
2876
|
+
this.operation = op;
|
|
2877
|
+
if (op.done === void 0) throw new Error("operation is missing the done field");
|
|
2878
|
+
if (!op.done) throw new StillRunningError();
|
|
2879
|
+
if (op.result?.$case === "error") {
|
|
2880
|
+
const err = op.result.error;
|
|
2881
|
+
const msg = err.message !== void 0 && err.message !== "" ? err.message : "unknown error";
|
|
2882
|
+
const errorMsg = err.errorCode !== void 0 ? `[${err.errorCode}] ${msg}` : msg;
|
|
2883
|
+
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
2884
|
+
}
|
|
2885
|
+
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
2886
|
+
result = z.lazy(() => unmarshalUndeleteMigrationResponseSchema).parse(op.result.response);
|
|
2887
|
+
};
|
|
2888
|
+
await executeWait(call, options);
|
|
2889
|
+
if (result === void 0) throw new Error("operation completed without a result.");
|
|
2890
|
+
return result;
|
|
2891
|
+
}
|
|
2892
|
+
/** Checks whether the operation has completed */
|
|
2893
|
+
async done(options) {
|
|
2894
|
+
const op = await this.getOperation({ name: this.operation.name }, options);
|
|
2895
|
+
this.operation = op;
|
|
2896
|
+
return op.done;
|
|
2897
|
+
}
|
|
2898
|
+
};
|
|
2319
2899
|
var UndeleteProjectOperation = class {
|
|
2320
2900
|
constructor(operation, getOperation) {
|
|
2321
2901
|
this.operation = operation;
|
|
@@ -2541,6 +3121,52 @@ var UpdateEndpointOperation = class {
|
|
|
2541
3121
|
return op.done;
|
|
2542
3122
|
}
|
|
2543
3123
|
};
|
|
3124
|
+
var UpdateMigrationOperation = class {
|
|
3125
|
+
constructor(operation, getOperation) {
|
|
3126
|
+
this.operation = operation;
|
|
3127
|
+
this.getOperation = getOperation;
|
|
3128
|
+
}
|
|
3129
|
+
/** Returns the server-assigned name of the long-running operation. */
|
|
3130
|
+
name() {
|
|
3131
|
+
return Promise.resolve(this.operation.name);
|
|
3132
|
+
}
|
|
3133
|
+
/** Returns metadata associated with the long-running operation. */
|
|
3134
|
+
metadata() {
|
|
3135
|
+
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
3136
|
+
return Promise.resolve(z.lazy(() => unmarshalMigrationOperationMetadataSchema).parse(this.operation.metadata));
|
|
3137
|
+
}
|
|
3138
|
+
/**
|
|
3139
|
+
* Polls the operation until it completes.
|
|
3140
|
+
*
|
|
3141
|
+
* Throws if the operation failed.
|
|
3142
|
+
*/
|
|
3143
|
+
async wait(options) {
|
|
3144
|
+
let result;
|
|
3145
|
+
const call = async (callSignal) => {
|
|
3146
|
+
const op = await this.getOperation({ name: this.operation.name }, callSignal !== void 0 ? { signal: callSignal } : void 0);
|
|
3147
|
+
this.operation = op;
|
|
3148
|
+
if (op.done === void 0) throw new Error("operation is missing the done field");
|
|
3149
|
+
if (!op.done) throw new StillRunningError();
|
|
3150
|
+
if (op.result?.$case === "error") {
|
|
3151
|
+
const err = op.result.error;
|
|
3152
|
+
const msg = err.message !== void 0 && err.message !== "" ? err.message : "unknown error";
|
|
3153
|
+
const errorMsg = err.errorCode !== void 0 ? `[${err.errorCode}] ${msg}` : msg;
|
|
3154
|
+
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
3155
|
+
}
|
|
3156
|
+
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
3157
|
+
result = z.lazy(() => unmarshalMigrationSchema).parse(op.result.response);
|
|
3158
|
+
};
|
|
3159
|
+
await executeWait(call, options);
|
|
3160
|
+
if (result === void 0) throw new Error("operation completed without a result.");
|
|
3161
|
+
return result;
|
|
3162
|
+
}
|
|
3163
|
+
/** Checks whether the operation has completed */
|
|
3164
|
+
async done(options) {
|
|
3165
|
+
const op = await this.getOperation({ name: this.operation.name }, options);
|
|
3166
|
+
this.operation = op;
|
|
3167
|
+
return op.done;
|
|
3168
|
+
}
|
|
3169
|
+
};
|
|
2544
3170
|
var UpdateProjectOperation = class {
|
|
2545
3171
|
constructor(operation, getOperation) {
|
|
2546
3172
|
this.operation = operation;
|
|
@@ -2681,5 +3307,5 @@ var UpdateSnapshotScheduleOperation = class {
|
|
|
2681
3307
|
};
|
|
2682
3308
|
|
|
2683
3309
|
//#endregion
|
|
2684
|
-
export { CreateBranchOperation, CreateCatalogOperation, CreateCdfConfigOperation, CreateDataApiOperation, CreateDatabaseOperation, CreateEndpointOperation, CreateProjectOperation, CreateRoleOperation, CreateSnapshotOperation, CreateSyncedTableOperation, DeleteBranchOperation, DeleteCatalogOperation, DeleteCdfConfigOperation, DeleteDataApiOperation, DeleteDatabaseOperation, DeleteEndpointOperation, DeleteProjectOperation, DeleteRoleOperation, DeleteSnapshotOperation, DeleteSyncedTableOperation, PostgresClient, UndeleteBranchOperation, UndeleteProjectOperation, UpdateBranchOperation, UpdateDataApiOperation, UpdateDatabaseOperation, UpdateEndpointOperation, UpdateProjectOperation, UpdateRoleOperation, UpdateSnapshotScheduleOperation };
|
|
3310
|
+
export { AcknowledgeAssessmentWarningsOperation, AssessMigrationOperation, CreateBranchOperation, CreateCatalogOperation, CreateCdfConfigOperation, CreateDataApiOperation, CreateDatabaseOperation, CreateEndpointOperation, CreateMigrationOperation, CreateProjectOperation, CreateRoleOperation, CreateSnapshotOperation, CreateSyncedTableOperation, DeleteBranchOperation, DeleteCatalogOperation, DeleteCdfConfigOperation, DeleteDataApiOperation, DeleteDatabaseOperation, DeleteEndpointOperation, DeleteMigrationOperation, DeleteProjectOperation, DeleteRoleOperation, DeleteSnapshotOperation, DeleteSyncedTableOperation, PostgresClient, StartMigrationOperation, UndeleteBranchOperation, UndeleteMigrationOperation, UndeleteProjectOperation, UpdateBranchOperation, UpdateDataApiOperation, UpdateDatabaseOperation, UpdateEndpointOperation, UpdateMigrationOperation, UpdateProjectOperation, UpdateRoleOperation, UpdateSnapshotScheduleOperation };
|
|
2685
3311
|
//# sourceMappingURL=client.js.map
|