@databricks/sdk-postgres 0.53.0 → 0.53.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.js +1 -1
- package/dist/v1/client.d.ts +167 -2
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +635 -25
- 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 +343 -24
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +256 -38
- package/dist/v1/model.js.map +1 -1
- package/package.json +1 -1
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();
|
|
@@ -1421,7 +1709,7 @@ var PostgresClient = class {
|
|
|
1421
1709
|
return new UpdateSnapshotScheduleOperation(await this.updateSnapshotScheduleBase(req, options), (req, options) => this.getOperation(req, options));
|
|
1422
1710
|
}
|
|
1423
1711
|
};
|
|
1424
|
-
var
|
|
1712
|
+
var AcknowledgeAssessmentWarningsOperation = class {
|
|
1425
1713
|
constructor(operation, getOperation) {
|
|
1426
1714
|
this.operation = operation;
|
|
1427
1715
|
this.getOperation = getOperation;
|
|
@@ -1433,7 +1721,7 @@ var CreateBranchOperation = class {
|
|
|
1433
1721
|
/** Returns metadata associated with the long-running operation. */
|
|
1434
1722
|
metadata() {
|
|
1435
1723
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1436
|
-
return Promise.resolve(z.lazy(() =>
|
|
1724
|
+
return Promise.resolve(z.lazy(() => unmarshalMigrationOperationMetadataSchema).parse(this.operation.metadata));
|
|
1437
1725
|
}
|
|
1438
1726
|
/**
|
|
1439
1727
|
* Polls the operation until it completes.
|
|
@@ -1454,7 +1742,7 @@ var CreateBranchOperation = class {
|
|
|
1454
1742
|
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
1455
1743
|
}
|
|
1456
1744
|
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
1457
|
-
result = z.lazy(() =>
|
|
1745
|
+
result = z.lazy(() => unmarshalAcknowledgeAssessmentWarningsResponseSchema).parse(op.result.response);
|
|
1458
1746
|
};
|
|
1459
1747
|
await executeWait(call, options);
|
|
1460
1748
|
if (result === void 0) throw new Error("operation completed without a result.");
|
|
@@ -1467,7 +1755,7 @@ var CreateBranchOperation = class {
|
|
|
1467
1755
|
return op.done;
|
|
1468
1756
|
}
|
|
1469
1757
|
};
|
|
1470
|
-
var
|
|
1758
|
+
var AssessMigrationOperation = class {
|
|
1471
1759
|
constructor(operation, getOperation) {
|
|
1472
1760
|
this.operation = operation;
|
|
1473
1761
|
this.getOperation = getOperation;
|
|
@@ -1479,7 +1767,7 @@ var CreateCatalogOperation = class {
|
|
|
1479
1767
|
/** Returns metadata associated with the long-running operation. */
|
|
1480
1768
|
metadata() {
|
|
1481
1769
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1482
|
-
return Promise.resolve(z.lazy(() =>
|
|
1770
|
+
return Promise.resolve(z.lazy(() => unmarshalMigrationOperationMetadataSchema).parse(this.operation.metadata));
|
|
1483
1771
|
}
|
|
1484
1772
|
/**
|
|
1485
1773
|
* Polls the operation until it completes.
|
|
@@ -1500,7 +1788,7 @@ var CreateCatalogOperation = class {
|
|
|
1500
1788
|
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
1501
1789
|
}
|
|
1502
1790
|
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
1503
|
-
result = z.lazy(() =>
|
|
1791
|
+
result = z.lazy(() => unmarshalAssessMigrationResponseSchema).parse(op.result.response);
|
|
1504
1792
|
};
|
|
1505
1793
|
await executeWait(call, options);
|
|
1506
1794
|
if (result === void 0) throw new Error("operation completed without a result.");
|
|
@@ -1513,7 +1801,7 @@ var CreateCatalogOperation = class {
|
|
|
1513
1801
|
return op.done;
|
|
1514
1802
|
}
|
|
1515
1803
|
};
|
|
1516
|
-
var
|
|
1804
|
+
var CreateBranchOperation = class {
|
|
1517
1805
|
constructor(operation, getOperation) {
|
|
1518
1806
|
this.operation = operation;
|
|
1519
1807
|
this.getOperation = getOperation;
|
|
@@ -1525,7 +1813,7 @@ var CreateCdfConfigOperation = class {
|
|
|
1525
1813
|
/** Returns metadata associated with the long-running operation. */
|
|
1526
1814
|
metadata() {
|
|
1527
1815
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1528
|
-
return Promise.resolve(z.lazy(() =>
|
|
1816
|
+
return Promise.resolve(z.lazy(() => unmarshalBranchOperationMetadataSchema).parse(this.operation.metadata));
|
|
1529
1817
|
}
|
|
1530
1818
|
/**
|
|
1531
1819
|
* Polls the operation until it completes.
|
|
@@ -1546,7 +1834,7 @@ var CreateCdfConfigOperation = class {
|
|
|
1546
1834
|
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
1547
1835
|
}
|
|
1548
1836
|
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
1549
|
-
result = z.lazy(() =>
|
|
1837
|
+
result = z.lazy(() => unmarshalBranchSchema).parse(op.result.response);
|
|
1550
1838
|
};
|
|
1551
1839
|
await executeWait(call, options);
|
|
1552
1840
|
if (result === void 0) throw new Error("operation completed without a result.");
|
|
@@ -1559,7 +1847,7 @@ var CreateCdfConfigOperation = class {
|
|
|
1559
1847
|
return op.done;
|
|
1560
1848
|
}
|
|
1561
1849
|
};
|
|
1562
|
-
var
|
|
1850
|
+
var CreateCatalogOperation = class {
|
|
1563
1851
|
constructor(operation, getOperation) {
|
|
1564
1852
|
this.operation = operation;
|
|
1565
1853
|
this.getOperation = getOperation;
|
|
@@ -1571,7 +1859,7 @@ var CreateDataApiOperation = class {
|
|
|
1571
1859
|
/** Returns metadata associated with the long-running operation. */
|
|
1572
1860
|
metadata() {
|
|
1573
1861
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1574
|
-
return Promise.resolve(z.lazy(() =>
|
|
1862
|
+
return Promise.resolve(z.lazy(() => unmarshalCatalogOperationMetadataSchema).parse(this.operation.metadata));
|
|
1575
1863
|
}
|
|
1576
1864
|
/**
|
|
1577
1865
|
* Polls the operation until it completes.
|
|
@@ -1592,7 +1880,7 @@ var CreateDataApiOperation = class {
|
|
|
1592
1880
|
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
1593
1881
|
}
|
|
1594
1882
|
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
1595
|
-
result = z.lazy(() =>
|
|
1883
|
+
result = z.lazy(() => unmarshalCatalogSchema).parse(op.result.response);
|
|
1596
1884
|
};
|
|
1597
1885
|
await executeWait(call, options);
|
|
1598
1886
|
if (result === void 0) throw new Error("operation completed without a result.");
|
|
@@ -1605,7 +1893,7 @@ var CreateDataApiOperation = class {
|
|
|
1605
1893
|
return op.done;
|
|
1606
1894
|
}
|
|
1607
1895
|
};
|
|
1608
|
-
var
|
|
1896
|
+
var CreateCdfConfigOperation = class {
|
|
1609
1897
|
constructor(operation, getOperation) {
|
|
1610
1898
|
this.operation = operation;
|
|
1611
1899
|
this.getOperation = getOperation;
|
|
@@ -1617,7 +1905,7 @@ var CreateDatabaseOperation = class {
|
|
|
1617
1905
|
/** Returns metadata associated with the long-running operation. */
|
|
1618
1906
|
metadata() {
|
|
1619
1907
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1620
|
-
return Promise.resolve(z.lazy(() =>
|
|
1908
|
+
return Promise.resolve(z.lazy(() => unmarshalCdfConfigOperationMetadataSchema).parse(this.operation.metadata));
|
|
1621
1909
|
}
|
|
1622
1910
|
/**
|
|
1623
1911
|
* Polls the operation until it completes.
|
|
@@ -1638,7 +1926,7 @@ var CreateDatabaseOperation = class {
|
|
|
1638
1926
|
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
1639
1927
|
}
|
|
1640
1928
|
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
1641
|
-
result = z.lazy(() =>
|
|
1929
|
+
result = z.lazy(() => unmarshalCdfConfigSchema).parse(op.result.response);
|
|
1642
1930
|
};
|
|
1643
1931
|
await executeWait(call, options);
|
|
1644
1932
|
if (result === void 0) throw new Error("operation completed without a result.");
|
|
@@ -1651,7 +1939,7 @@ var CreateDatabaseOperation = class {
|
|
|
1651
1939
|
return op.done;
|
|
1652
1940
|
}
|
|
1653
1941
|
};
|
|
1654
|
-
var
|
|
1942
|
+
var CreateDataApiOperation = class {
|
|
1655
1943
|
constructor(operation, getOperation) {
|
|
1656
1944
|
this.operation = operation;
|
|
1657
1945
|
this.getOperation = getOperation;
|
|
@@ -1663,7 +1951,7 @@ var CreateEndpointOperation = class {
|
|
|
1663
1951
|
/** Returns metadata associated with the long-running operation. */
|
|
1664
1952
|
metadata() {
|
|
1665
1953
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1666
|
-
return Promise.resolve(z.lazy(() =>
|
|
1954
|
+
return Promise.resolve(z.lazy(() => unmarshalDataApiOperationMetadataSchema).parse(this.operation.metadata));
|
|
1667
1955
|
}
|
|
1668
1956
|
/**
|
|
1669
1957
|
* Polls the operation until it completes.
|
|
@@ -1684,7 +1972,7 @@ var CreateEndpointOperation = class {
|
|
|
1684
1972
|
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
1685
1973
|
}
|
|
1686
1974
|
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
1687
|
-
result = z.lazy(() =>
|
|
1975
|
+
result = z.lazy(() => unmarshalDataApiSchema).parse(op.result.response);
|
|
1688
1976
|
};
|
|
1689
1977
|
await executeWait(call, options);
|
|
1690
1978
|
if (result === void 0) throw new Error("operation completed without a result.");
|
|
@@ -1697,7 +1985,7 @@ var CreateEndpointOperation = class {
|
|
|
1697
1985
|
return op.done;
|
|
1698
1986
|
}
|
|
1699
1987
|
};
|
|
1700
|
-
var
|
|
1988
|
+
var CreateDatabaseOperation = class {
|
|
1701
1989
|
constructor(operation, getOperation) {
|
|
1702
1990
|
this.operation = operation;
|
|
1703
1991
|
this.getOperation = getOperation;
|
|
@@ -1709,7 +1997,7 @@ var CreateProjectOperation = class {
|
|
|
1709
1997
|
/** Returns metadata associated with the long-running operation. */
|
|
1710
1998
|
metadata() {
|
|
1711
1999
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1712
|
-
return Promise.resolve(z.lazy(() =>
|
|
2000
|
+
return Promise.resolve(z.lazy(() => unmarshalDatabaseOperationMetadataSchema).parse(this.operation.metadata));
|
|
1713
2001
|
}
|
|
1714
2002
|
/**
|
|
1715
2003
|
* Polls the operation until it completes.
|
|
@@ -1730,7 +2018,7 @@ var CreateProjectOperation = class {
|
|
|
1730
2018
|
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
1731
2019
|
}
|
|
1732
2020
|
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
1733
|
-
result = z.lazy(() =>
|
|
2021
|
+
result = z.lazy(() => unmarshalDatabaseSchema).parse(op.result.response);
|
|
1734
2022
|
};
|
|
1735
2023
|
await executeWait(call, options);
|
|
1736
2024
|
if (result === void 0) throw new Error("operation completed without a result.");
|
|
@@ -1743,7 +2031,7 @@ var CreateProjectOperation = class {
|
|
|
1743
2031
|
return op.done;
|
|
1744
2032
|
}
|
|
1745
2033
|
};
|
|
1746
|
-
var
|
|
2034
|
+
var CreateEndpointOperation = class {
|
|
1747
2035
|
constructor(operation, getOperation) {
|
|
1748
2036
|
this.operation = operation;
|
|
1749
2037
|
this.getOperation = getOperation;
|
|
@@ -1755,7 +2043,145 @@ var CreateRoleOperation = class {
|
|
|
1755
2043
|
/** Returns metadata associated with the long-running operation. */
|
|
1756
2044
|
metadata() {
|
|
1757
2045
|
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
1758
|
-
return Promise.resolve(z.lazy(() =>
|
|
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));
|
|
2139
|
+
}
|
|
2140
|
+
/**
|
|
2141
|
+
* Polls the operation until it completes.
|
|
2142
|
+
*
|
|
2143
|
+
* Throws if the operation failed.
|
|
2144
|
+
*/
|
|
2145
|
+
async wait(options) {
|
|
2146
|
+
let result;
|
|
2147
|
+
const call = async (callSignal) => {
|
|
2148
|
+
const op = await this.getOperation({ name: this.operation.name }, callSignal !== void 0 ? { signal: callSignal } : void 0);
|
|
2149
|
+
this.operation = op;
|
|
2150
|
+
if (op.done === void 0) throw new Error("operation is missing the done field");
|
|
2151
|
+
if (!op.done) throw new StillRunningError();
|
|
2152
|
+
if (op.result?.$case === "error") {
|
|
2153
|
+
const err = op.result.error;
|
|
2154
|
+
const msg = err.message !== void 0 && err.message !== "" ? err.message : "unknown error";
|
|
2155
|
+
const errorMsg = err.errorCode !== void 0 ? `[${err.errorCode}] ${msg}` : msg;
|
|
2156
|
+
throw new Error(`operation failed: ${errorMsg}`, { cause: err });
|
|
2157
|
+
}
|
|
2158
|
+
if (op.result?.$case !== "response") throw new Error("operation completed without a response");
|
|
2159
|
+
result = z.lazy(() => unmarshalProjectSchema).parse(op.result.response);
|
|
2160
|
+
};
|
|
2161
|
+
await executeWait(call, options);
|
|
2162
|
+
if (result === void 0) throw new Error("operation completed without a result.");
|
|
2163
|
+
return result;
|
|
2164
|
+
}
|
|
2165
|
+
/** Checks whether the operation has completed */
|
|
2166
|
+
async done(options) {
|
|
2167
|
+
const op = await this.getOperation({ name: this.operation.name }, options);
|
|
2168
|
+
this.operation = op;
|
|
2169
|
+
return op.done;
|
|
2170
|
+
}
|
|
2171
|
+
};
|
|
2172
|
+
var CreateRoleOperation = class {
|
|
2173
|
+
constructor(operation, getOperation) {
|
|
2174
|
+
this.operation = operation;
|
|
2175
|
+
this.getOperation = getOperation;
|
|
2176
|
+
}
|
|
2177
|
+
/** Returns the server-assigned name of the long-running operation. */
|
|
2178
|
+
name() {
|
|
2179
|
+
return Promise.resolve(this.operation.name);
|
|
2180
|
+
}
|
|
2181
|
+
/** Returns metadata associated with the long-running operation. */
|
|
2182
|
+
metadata() {
|
|
2183
|
+
if (this.operation.metadata === void 0) return Promise.resolve(void 0);
|
|
2184
|
+
return Promise.resolve(z.lazy(() => unmarshalRoleOperationMetadataSchema).parse(this.operation.metadata));
|
|
1759
2185
|
}
|
|
1760
2186
|
/**
|
|
1761
2187
|
* Polls the operation until it completes.
|
|
@@ -2127,6 +2553,52 @@ var DeleteEndpointOperation = class {
|
|
|
2127
2553
|
return op.done;
|
|
2128
2554
|
}
|
|
2129
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
|
+
};
|
|
2130
2602
|
var DeleteProjectOperation = class {
|
|
2131
2603
|
constructor(operation, getOperation) {
|
|
2132
2604
|
this.operation = operation;
|
|
@@ -2291,6 +2763,52 @@ var DeleteSyncedTableOperation = class {
|
|
|
2291
2763
|
return op.done;
|
|
2292
2764
|
}
|
|
2293
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
|
+
};
|
|
2294
2812
|
var UndeleteBranchOperation = class {
|
|
2295
2813
|
constructor(operation, getOperation) {
|
|
2296
2814
|
this.operation = operation;
|
|
@@ -2332,6 +2850,52 @@ var UndeleteBranchOperation = class {
|
|
|
2332
2850
|
return op.done;
|
|
2333
2851
|
}
|
|
2334
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
|
+
};
|
|
2335
2899
|
var UndeleteProjectOperation = class {
|
|
2336
2900
|
constructor(operation, getOperation) {
|
|
2337
2901
|
this.operation = operation;
|
|
@@ -2557,6 +3121,52 @@ var UpdateEndpointOperation = class {
|
|
|
2557
3121
|
return op.done;
|
|
2558
3122
|
}
|
|
2559
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
|
+
};
|
|
2560
3170
|
var UpdateProjectOperation = class {
|
|
2561
3171
|
constructor(operation, getOperation) {
|
|
2562
3172
|
this.operation = operation;
|
|
@@ -2697,5 +3307,5 @@ var UpdateSnapshotScheduleOperation = class {
|
|
|
2697
3307
|
};
|
|
2698
3308
|
|
|
2699
3309
|
//#endregion
|
|
2700
|
-
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 };
|
|
2701
3311
|
//# sourceMappingURL=client.js.map
|