@alicloud/dts20200101 1.5.2 → 1.5.4

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/client.d.ts CHANGED
@@ -5,6 +5,11 @@ import * as $_model from './models/model';
5
5
  export * from './models/model';
6
6
  export default class Client extends OpenApi {
7
7
  constructor(config: $OpenApiUtil.Config);
8
+ _postOSSObject(bucketName: string, form: {
9
+ [key: string]: any;
10
+ }): Promise<{
11
+ [key: string]: any;
12
+ }>;
8
13
  getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: {
9
14
  [key: string]: string;
10
15
  }, endpoint: string): string;
package/dist/client.js CHANGED
@@ -35,17 +35,10 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
38
  Object.defineProperty(exports, "__esModule", { value: true });
42
39
  // This file is auto-generated, don't edit it
43
40
  const $dara = __importStar(require("@darabonba/typescript"));
44
- const oss_client_1 = __importStar(require("@alicloud/oss-client")), $OSS = oss_client_1;
45
- const openplatform20191219_1 = __importStar(require("@alicloud/openplatform20191219")), $OpenPlatform = openplatform20191219_1;
46
- const $OSSUtil = __importStar(require("@alicloud/oss-util"));
47
- const $FileForm = __importStar(require("@alicloud/tea-fileform"));
48
- const openapi_core_1 = __importDefault(require("@alicloud/openapi-core"));
41
+ const openapi_core_1 = __importStar(require("@alicloud/openapi-core")), $OpenApi = openapi_core_1;
49
42
  const openapi_core_2 = require("@alicloud/openapi-core");
50
43
  const $_model = __importStar(require("./models/model"));
51
44
  __exportStar(require("./models/model"), exports);
@@ -113,6 +106,38 @@ class Client extends openapi_core_1.default {
113
106
  this.checkConfig(config);
114
107
  this._endpoint = this.getEndpoint("dts", this._regionId, this._endpointRule, this._network, this._suffix, this._endpointMap, this._endpoint);
115
108
  }
109
+ async _postOSSObject(bucketName, form) {
110
+ let request_ = new $dara.Request();
111
+ let boundary = $dara.Form.getBoundary();
112
+ request_.protocol = "HTTPS";
113
+ request_.method = "POST";
114
+ request_.pathname = `/`;
115
+ request_.headers = {
116
+ host: String(form["host"]),
117
+ date: openapi_core_2.OpenApiUtil.getDateUTCString(),
118
+ 'user-agent': openapi_core_2.OpenApiUtil.getUserAgent(""),
119
+ };
120
+ request_.headers["content-type"] = `multipart/form-data; boundary=${boundary}`;
121
+ request_.body = $dara.Form.toFileForm(form, boundary);
122
+ let response_ = await $dara.doAction(request_);
123
+ let respMap = null;
124
+ let bodyStr = await $dara.Stream.readAsString(response_.body);
125
+ if ((response_.statusCode >= 400) && (response_.statusCode < 600)) {
126
+ respMap = $dara.XML.parseXml(bodyStr, null);
127
+ let err = respMap["Error"];
128
+ throw new $OpenApi.ClientError({
129
+ code: String(err["Code"]),
130
+ message: String(err["Message"]),
131
+ data: {
132
+ httpCode: response_.statusCode,
133
+ requestId: String(err["RequestId"]),
134
+ hostId: String(err["HostId"]),
135
+ },
136
+ });
137
+ }
138
+ respMap = $dara.XML.parseXml(bodyStr, null);
139
+ return Object.assign({}, respMap);
140
+ }
116
141
  getEndpoint(productId, regionId, endpointRule, network, suffix, endpointMap, endpoint) {
117
142
  if (!$dara.isNull(endpoint)) {
118
143
  return endpoint;
@@ -357,12 +382,19 @@ class Client extends openapi_core_1.default {
357
382
  }
358
383
  async configureDtsJobAdvance(request, runtime) {
359
384
  // Step 0: init client
360
- let accessKeyId = await this._credential.getAccessKeyId();
361
- let accessKeySecret = await this._credential.getAccessKeySecret();
362
- let securityToken = await this._credential.getSecurityToken();
363
- let credentialType = this._credential.getType();
385
+ if ($dara.isNull(this._credential)) {
386
+ throw new $OpenApi.ClientError({
387
+ code: "InvalidCredentials",
388
+ message: "Please set up the credentials correctly. If you are setting them through environment variables, please ensure that ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set correctly. See https://help.aliyun.com/zh/sdk/developer-reference/configure-the-alibaba-cloud-accesskey-environment-variable-on-linux-macos-and-windows-systems for more details.",
389
+ });
390
+ }
391
+ let credentialModel = await this._credential.getCredential();
392
+ let accessKeyId = credentialModel.accessKeyId;
393
+ let accessKeySecret = credentialModel.accessKeySecret;
394
+ let securityToken = credentialModel.securityToken;
395
+ let credentialType = credentialModel.type;
364
396
  let openPlatformEndpoint = this._openPlatformEndpoint;
365
- if ($dara.isNull(openPlatformEndpoint)) {
397
+ if ($dara.isNull(openPlatformEndpoint) || openPlatformEndpoint == "") {
366
398
  openPlatformEndpoint = "openplatform.aliyuncs.com";
367
399
  }
368
400
  if ($dara.isNull(credentialType)) {
@@ -377,51 +409,54 @@ class Client extends openapi_core_1.default {
377
409
  protocol: this._protocol,
378
410
  regionId: this._regionId,
379
411
  });
380
- let authClient = new openplatform20191219_1.default(authConfig);
381
- let authRequest = new $OpenPlatform.AuthorizeFileUploadRequest({
382
- product: "Dts",
383
- regionId: this._regionId,
412
+ let authClient = new openapi_core_1.default(authConfig);
413
+ let authRequest = {
414
+ Product: "Dts",
415
+ RegionId: this._regionId,
416
+ };
417
+ let authReq = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
418
+ query: openapi_core_2.OpenApiUtil.query(authRequest),
384
419
  });
385
- let authResponse = new $OpenPlatform.AuthorizeFileUploadResponse({});
386
- let ossConfig = new $OSS.Config({
387
- accessKeyId: accessKeyId,
388
- accessKeySecret: accessKeySecret,
389
- type: "access_key",
390
- protocol: this._protocol,
391
- regionId: this._regionId,
420
+ let authParams = new openapi_core_2.$OpenApiUtil.Params({
421
+ action: "AuthorizeFileUpload",
422
+ version: "2019-12-19",
423
+ protocol: "HTTPS",
424
+ pathname: "/",
425
+ method: "GET",
426
+ authType: "AK",
427
+ style: "RPC",
428
+ reqBodyType: "formData",
429
+ bodyType: "json",
392
430
  });
393
- let ossClient = new oss_client_1.default(ossConfig);
394
- let fileObj = new $FileForm.FileField({});
395
- let ossHeader = new $OSS.PostObjectRequestHeader({});
396
- let uploadRequest = new $OSS.PostObjectRequest({});
397
- let ossRuntime = new $OSSUtil.RuntimeOptions({});
398
- openapi_core_2.OpenApiUtil.convert(runtime, ossRuntime);
431
+ let authResponse = {};
432
+ let fileObj = new $dara.FileField({});
433
+ let ossHeader = {};
434
+ let tmpBody = {};
435
+ let useAccelerate = false;
436
+ let authResponseBody = {};
399
437
  let configureDtsJobReq = new $_model.ConfigureDtsJobRequest({});
400
438
  openapi_core_2.OpenApiUtil.convert(request, configureDtsJobReq);
401
439
  if (!$dara.isNull(request.fileOssUrlObject)) {
402
- authResponse = await authClient.authorizeFileUploadWithOptions(authRequest, runtime);
403
- ossConfig.accessKeyId = authResponse.body.accessKeyId;
404
- ossConfig.endpoint = openapi_core_2.OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, this._endpointType);
405
- ossClient = new oss_client_1.default(ossConfig);
406
- fileObj = new $FileForm.FileField({
407
- filename: authResponse.body.objectKey,
440
+ authResponse = await authClient.callApi(authParams, authReq, runtime);
441
+ tmpBody = authResponse["body"];
442
+ useAccelerate = Boolean(tmpBody["UseAccelerate"]);
443
+ authResponseBody = openapi_core_2.OpenApiUtil.stringifyMapValue(tmpBody);
444
+ fileObj = new $dara.FileField({
445
+ filename: authResponseBody["ObjectKey"],
408
446
  content: request.fileOssUrlObject,
409
447
  contentType: "",
410
448
  });
411
- ossHeader = new $OSS.PostObjectRequestHeader({
412
- accessKeyId: authResponse.body.accessKeyId,
413
- policy: authResponse.body.encodedPolicy,
414
- signature: authResponse.body.signature,
415
- key: authResponse.body.objectKey,
449
+ ossHeader = {
450
+ host: `${authResponseBody["Bucket"]}.${openapi_core_2.OpenApiUtil.getEndpoint(authResponseBody["Endpoint"], useAccelerate, this._endpointType)}`,
451
+ OSSAccessKeyId: authResponseBody["AccessKeyId"],
452
+ policy: authResponseBody["EncodedPolicy"],
453
+ Signature: authResponseBody["Signature"],
454
+ key: authResponseBody["ObjectKey"],
416
455
  file: fileObj,
417
- successActionStatus: "201",
418
- });
419
- uploadRequest = new $OSS.PostObjectRequest({
420
- bucketName: authResponse.body.bucket,
421
- header: ossHeader,
422
- });
423
- await ossClient.postObject(uploadRequest, ossRuntime);
424
- configureDtsJobReq.fileOssUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
456
+ success_action_status: "201",
457
+ };
458
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
459
+ configureDtsJobReq.fileOssUrl = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
425
460
  }
426
461
  let configureDtsJobResp = await this.configureDtsJobWithOptions(configureDtsJobReq, runtime);
427
462
  return configureDtsJobResp;
@@ -3508,6 +3543,9 @@ class Client extends openapi_core_1.default {
3508
3543
  async describeGadInstancesWithOptions(request, runtime) {
3509
3544
  request.validate();
3510
3545
  let query = {};
3546
+ if (!$dara.isNull(request.dbEngineTypes)) {
3547
+ query["DbEngineTypes"] = request.dbEngineTypes;
3548
+ }
3511
3549
  if (!$dara.isNull(request.instanceName)) {
3512
3550
  query["InstanceName"] = request.instanceName;
3513
3551
  }
@@ -5414,12 +5452,19 @@ class Client extends openapi_core_1.default {
5414
5452
  }
5415
5453
  async modifyDtsJobAdvance(request, runtime) {
5416
5454
  // Step 0: init client
5417
- let accessKeyId = await this._credential.getAccessKeyId();
5418
- let accessKeySecret = await this._credential.getAccessKeySecret();
5419
- let securityToken = await this._credential.getSecurityToken();
5420
- let credentialType = this._credential.getType();
5455
+ if ($dara.isNull(this._credential)) {
5456
+ throw new $OpenApi.ClientError({
5457
+ code: "InvalidCredentials",
5458
+ message: "Please set up the credentials correctly. If you are setting them through environment variables, please ensure that ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set correctly. See https://help.aliyun.com/zh/sdk/developer-reference/configure-the-alibaba-cloud-accesskey-environment-variable-on-linux-macos-and-windows-systems for more details.",
5459
+ });
5460
+ }
5461
+ let credentialModel = await this._credential.getCredential();
5462
+ let accessKeyId = credentialModel.accessKeyId;
5463
+ let accessKeySecret = credentialModel.accessKeySecret;
5464
+ let securityToken = credentialModel.securityToken;
5465
+ let credentialType = credentialModel.type;
5421
5466
  let openPlatformEndpoint = this._openPlatformEndpoint;
5422
- if ($dara.isNull(openPlatformEndpoint)) {
5467
+ if ($dara.isNull(openPlatformEndpoint) || openPlatformEndpoint == "") {
5423
5468
  openPlatformEndpoint = "openplatform.aliyuncs.com";
5424
5469
  }
5425
5470
  if ($dara.isNull(credentialType)) {
@@ -5434,51 +5479,54 @@ class Client extends openapi_core_1.default {
5434
5479
  protocol: this._protocol,
5435
5480
  regionId: this._regionId,
5436
5481
  });
5437
- let authClient = new openplatform20191219_1.default(authConfig);
5438
- let authRequest = new $OpenPlatform.AuthorizeFileUploadRequest({
5439
- product: "Dts",
5440
- regionId: this._regionId,
5482
+ let authClient = new openapi_core_1.default(authConfig);
5483
+ let authRequest = {
5484
+ Product: "Dts",
5485
+ RegionId: this._regionId,
5486
+ };
5487
+ let authReq = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
5488
+ query: openapi_core_2.OpenApiUtil.query(authRequest),
5441
5489
  });
5442
- let authResponse = new $OpenPlatform.AuthorizeFileUploadResponse({});
5443
- let ossConfig = new $OSS.Config({
5444
- accessKeyId: accessKeyId,
5445
- accessKeySecret: accessKeySecret,
5446
- type: "access_key",
5447
- protocol: this._protocol,
5448
- regionId: this._regionId,
5490
+ let authParams = new openapi_core_2.$OpenApiUtil.Params({
5491
+ action: "AuthorizeFileUpload",
5492
+ version: "2019-12-19",
5493
+ protocol: "HTTPS",
5494
+ pathname: "/",
5495
+ method: "GET",
5496
+ authType: "AK",
5497
+ style: "RPC",
5498
+ reqBodyType: "formData",
5499
+ bodyType: "json",
5449
5500
  });
5450
- let ossClient = new oss_client_1.default(ossConfig);
5451
- let fileObj = new $FileForm.FileField({});
5452
- let ossHeader = new $OSS.PostObjectRequestHeader({});
5453
- let uploadRequest = new $OSS.PostObjectRequest({});
5454
- let ossRuntime = new $OSSUtil.RuntimeOptions({});
5455
- openapi_core_2.OpenApiUtil.convert(runtime, ossRuntime);
5501
+ let authResponse = {};
5502
+ let fileObj = new $dara.FileField({});
5503
+ let ossHeader = {};
5504
+ let tmpBody = {};
5505
+ let useAccelerate = false;
5506
+ let authResponseBody = {};
5456
5507
  let modifyDtsJobReq = new $_model.ModifyDtsJobRequest({});
5457
5508
  openapi_core_2.OpenApiUtil.convert(request, modifyDtsJobReq);
5458
5509
  if (!$dara.isNull(request.fileOssUrlObject)) {
5459
- authResponse = await authClient.authorizeFileUploadWithOptions(authRequest, runtime);
5460
- ossConfig.accessKeyId = authResponse.body.accessKeyId;
5461
- ossConfig.endpoint = openapi_core_2.OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, this._endpointType);
5462
- ossClient = new oss_client_1.default(ossConfig);
5463
- fileObj = new $FileForm.FileField({
5464
- filename: authResponse.body.objectKey,
5510
+ authResponse = await authClient.callApi(authParams, authReq, runtime);
5511
+ tmpBody = authResponse["body"];
5512
+ useAccelerate = Boolean(tmpBody["UseAccelerate"]);
5513
+ authResponseBody = openapi_core_2.OpenApiUtil.stringifyMapValue(tmpBody);
5514
+ fileObj = new $dara.FileField({
5515
+ filename: authResponseBody["ObjectKey"],
5465
5516
  content: request.fileOssUrlObject,
5466
5517
  contentType: "",
5467
5518
  });
5468
- ossHeader = new $OSS.PostObjectRequestHeader({
5469
- accessKeyId: authResponse.body.accessKeyId,
5470
- policy: authResponse.body.encodedPolicy,
5471
- signature: authResponse.body.signature,
5472
- key: authResponse.body.objectKey,
5519
+ ossHeader = {
5520
+ host: `${authResponseBody["Bucket"]}.${openapi_core_2.OpenApiUtil.getEndpoint(authResponseBody["Endpoint"], useAccelerate, this._endpointType)}`,
5521
+ OSSAccessKeyId: authResponseBody["AccessKeyId"],
5522
+ policy: authResponseBody["EncodedPolicy"],
5523
+ Signature: authResponseBody["Signature"],
5524
+ key: authResponseBody["ObjectKey"],
5473
5525
  file: fileObj,
5474
- successActionStatus: "201",
5475
- });
5476
- uploadRequest = new $OSS.PostObjectRequest({
5477
- bucketName: authResponse.body.bucket,
5478
- header: ossHeader,
5479
- });
5480
- await ossClient.postObject(uploadRequest, ossRuntime);
5481
- modifyDtsJobReq.fileOssUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
5526
+ success_action_status: "201",
5527
+ };
5528
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
5529
+ modifyDtsJobReq.fileOssUrl = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
5482
5530
  }
5483
5531
  let modifyDtsJobResp = await this.modifyDtsJobWithOptions(modifyDtsJobReq, runtime);
5484
5532
  return modifyDtsJobResp;
@@ -5996,9 +6044,15 @@ class Client extends openapi_core_1.default {
5996
6044
  if (!$dara.isNull(request.dtsJobId)) {
5997
6045
  query["DtsJobId"] = request.dtsJobId;
5998
6046
  }
6047
+ if (!$dara.isNull(request.modifyType)) {
6048
+ query["ModifyType"] = request.modifyType;
6049
+ }
5999
6050
  if (!$dara.isNull(request.regionId)) {
6000
6051
  query["RegionId"] = request.regionId;
6001
6052
  }
6053
+ if (!$dara.isNull(request.reserved)) {
6054
+ query["Reserved"] = request.reserved;
6055
+ }
6002
6056
  if (!$dara.isNull(request.resourceGroupId)) {
6003
6057
  query["ResourceGroupId"] = request.resourceGroupId;
6004
6058
  }
@@ -6163,6 +6217,18 @@ class Client extends openapi_core_1.default {
6163
6217
  if (!$dara.isNull(request.instanceId)) {
6164
6218
  query["InstanceId"] = request.instanceId;
6165
6219
  }
6220
+ if (!$dara.isNull(request.masterDatabaseName)) {
6221
+ query["MasterDatabaseName"] = request.masterDatabaseName;
6222
+ }
6223
+ if (!$dara.isNull(request.masterEngineArchType)) {
6224
+ query["MasterEngineArchType"] = request.masterEngineArchType;
6225
+ }
6226
+ if (!$dara.isNull(request.masterShardAccountName)) {
6227
+ query["MasterShardAccountName"] = request.masterShardAccountName;
6228
+ }
6229
+ if (!$dara.isNull(request.masterShardAccountPassword)) {
6230
+ query["MasterShardAccountPassword"] = request.masterShardAccountPassword;
6231
+ }
6166
6232
  if (!$dara.isNull(request.ownerId)) {
6167
6233
  query["OwnerId"] = request.ownerId;
6168
6234
  }
@@ -6172,12 +6238,18 @@ class Client extends openapi_core_1.default {
6172
6238
  if (!$dara.isNull(request.resourceGroupId)) {
6173
6239
  query["ResourceGroupId"] = request.resourceGroupId;
6174
6240
  }
6241
+ if (!$dara.isNull(request.slaveDatabaseName)) {
6242
+ query["SlaveDatabaseName"] = request.slaveDatabaseName;
6243
+ }
6175
6244
  if (!$dara.isNull(request.slaveDbInstanceId)) {
6176
6245
  query["SlaveDbInstanceId"] = request.slaveDbInstanceId;
6177
6246
  }
6178
6247
  if (!$dara.isNull(request.slaveDbInstanceRegion)) {
6179
6248
  query["SlaveDbInstanceRegion"] = request.slaveDbInstanceRegion;
6180
6249
  }
6250
+ if (!$dara.isNull(request.slaveEngineArchType)) {
6251
+ query["SlaveEngineArchType"] = request.slaveEngineArchType;
6252
+ }
6181
6253
  let req = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
6182
6254
  query: openapi_core_2.OpenApiUtil.query(query),
6183
6255
  });