@alicloud/dts20200101 1.7.0 → 1.7.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/client.d.ts CHANGED
@@ -7,7 +7,7 @@ export default class Client extends OpenApi {
7
7
  constructor(config: $OpenApiUtil.Config);
8
8
  _postOSSObject(bucketName: string, form: {
9
9
  [key: string]: any;
10
- }): Promise<{
10
+ }, runtime: $dara.RuntimeOptions): Promise<{
11
11
  [key: string]: any;
12
12
  }>;
13
13
  getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: {
package/dist/client.js CHANGED
@@ -106,37 +106,81 @@ class Client extends openapi_core_1.default {
106
106
  this.checkConfig(config);
107
107
  this._endpoint = this.getEndpoint("dts", this._regionId, this._endpointRule, this._network, this._suffix, this._endpointMap, this._endpoint);
108
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(""),
109
+ async _postOSSObject(bucketName, form, runtime) {
110
+ let _runtime = {
111
+ key: runtime.key || this._key,
112
+ cert: runtime.cert || this._cert,
113
+ ca: runtime.ca || this._ca,
114
+ readTimeout: runtime.readTimeout || this._readTimeout,
115
+ connectTimeout: runtime.connectTimeout || this._connectTimeout,
116
+ httpProxy: runtime.httpProxy || this._httpProxy,
117
+ httpsProxy: runtime.httpsProxy || this._httpsProxy,
118
+ noProxy: runtime.noProxy || this._noProxy,
119
+ socks5Proxy: runtime.socks5Proxy || this._socks5Proxy,
120
+ socks5NetWork: runtime.socks5NetWork || this._socks5NetWork,
121
+ maxIdleConns: runtime.maxIdleConns || this._maxIdleConns,
122
+ retryOptions: this._retryOptions,
123
+ ignoreSSL: runtime.ignoreSSL || false,
124
+ tlsMinVersion: this._tlsMinVersion,
119
125
  };
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);
126
+ let _retriesAttempted = 0;
127
+ let _lastRequest = null, _lastResponse = null;
128
+ let _context = new $dara.RetryPolicyContext({
129
+ retriesAttempted: _retriesAttempted,
130
+ });
131
+ while ($dara.shouldRetry(_runtime['retryOptions'], _context)) {
132
+ if (_retriesAttempted > 0) {
133
+ let _backoffTime = $dara.getBackoffDelay(_runtime['retryOptions'], _context);
134
+ if (_backoffTime > 0) {
135
+ await $dara.sleep(_backoffTime);
136
+ }
137
+ }
138
+ _retriesAttempted = _retriesAttempted + 1;
139
+ try {
140
+ let request_ = new $dara.Request();
141
+ let boundary = $dara.Form.getBoundary();
142
+ request_.protocol = "HTTPS";
143
+ request_.method = "POST";
144
+ request_.pathname = `/`;
145
+ request_.headers = {
146
+ host: String(form["host"]),
147
+ date: openapi_core_2.OpenApiUtil.getDateUTCString(),
148
+ 'user-agent': openapi_core_2.OpenApiUtil.getUserAgent(""),
149
+ };
150
+ request_.headers["content-type"] = `multipart/form-data; boundary=${boundary}`;
151
+ request_.body = $dara.Form.toFileForm(form, boundary);
152
+ _lastRequest = request_;
153
+ let response_ = await $dara.doAction(request_, _runtime);
154
+ _lastResponse = response_;
155
+ let respMap = null;
156
+ let bodyStr = await $dara.Stream.readAsString(response_.body);
157
+ if ((response_.statusCode >= 400) && (response_.statusCode < 600)) {
158
+ respMap = $dara.XML.parseXml(bodyStr, null);
159
+ let err = respMap["Error"];
160
+ throw new $OpenApi.ClientError({
161
+ code: String(err["Code"]),
162
+ message: String(err["Message"]),
163
+ data: {
164
+ httpCode: response_.statusCode,
165
+ requestId: String(err["RequestId"]),
166
+ hostId: String(err["HostId"]),
167
+ },
168
+ });
169
+ }
170
+ respMap = $dara.XML.parseXml(bodyStr, null);
171
+ return Object.assign({}, respMap);
172
+ }
173
+ catch (ex) {
174
+ _context = new $dara.RetryPolicyContext({
175
+ retriesAttempted: _retriesAttempted,
176
+ httpRequest: _lastRequest,
177
+ httpResponse: _lastResponse,
178
+ exception: ex,
179
+ });
180
+ continue;
181
+ }
182
+ }
183
+ throw $dara.newUnretryableError(_context);
140
184
  }
141
185
  getEndpoint(productId, regionId, endpointRule, network, suffix, endpointMap, endpoint) {
142
186
  if (!$dara.isNull(endpoint)) {
@@ -455,7 +499,7 @@ class Client extends openapi_core_1.default {
455
499
  file: fileObj,
456
500
  success_action_status: "201",
457
501
  };
458
- await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
502
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader, runtime);
459
503
  configureDtsJobReq.fileOssUrl = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
460
504
  }
461
505
  let configureDtsJobResp = await this.configureDtsJobWithOptions(configureDtsJobReq, runtime);
@@ -1449,6 +1493,9 @@ class Client extends openapi_core_1.default {
1449
1493
  if (!$dara.isNull(request.fileUrl)) {
1450
1494
  query["FileUrl"] = request.fileUrl;
1451
1495
  }
1496
+ if (!$dara.isNull(request.ragInstanceId)) {
1497
+ query["RagInstanceId"] = request.ragInstanceId;
1498
+ }
1452
1499
  if (!$dara.isNull(request.regionId)) {
1453
1500
  query["RegionId"] = request.regionId;
1454
1501
  }
@@ -1559,7 +1606,7 @@ class Client extends openapi_core_1.default {
1559
1606
  file: fileObj,
1560
1607
  success_action_status: "201",
1561
1608
  };
1562
- await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
1609
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader, runtime);
1563
1610
  createDocParserJobReq.fileUrl = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
1564
1611
  }
1565
1612
  let createDocParserJobResp = await this.createDocParserJobWithOptions(createDocParserJobReq, runtime);
@@ -3179,6 +3226,9 @@ class Client extends openapi_core_1.default {
3179
3226
  if (!$dara.isNull(request.dtsJobId)) {
3180
3227
  query["DtsJobId"] = request.dtsJobId;
3181
3228
  }
3229
+ if (!$dara.isNull(request.ragInstanceId)) {
3230
+ query["RagInstanceId"] = request.ragInstanceId;
3231
+ }
3182
3232
  if (!$dara.isNull(request.regionId)) {
3183
3233
  query["RegionId"] = request.regionId;
3184
3234
  }
@@ -3224,6 +3274,9 @@ class Client extends openapi_core_1.default {
3224
3274
  if (!$dara.isNull(request.dtsJobId)) {
3225
3275
  query["DtsJobId"] = request.dtsJobId;
3226
3276
  }
3277
+ if (!$dara.isNull(request.ragInstanceId)) {
3278
+ query["RagInstanceId"] = request.ragInstanceId;
3279
+ }
3227
3280
  if (!$dara.isNull(request.regionId)) {
3228
3281
  query["RegionId"] = request.regionId;
3229
3282
  }
@@ -5795,7 +5848,7 @@ class Client extends openapi_core_1.default {
5795
5848
  file: fileObj,
5796
5849
  success_action_status: "201",
5797
5850
  };
5798
- await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
5851
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader, runtime);
5799
5852
  modifyDtsJobReq.fileOssUrl = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
5800
5853
  }
5801
5854
  let modifyDtsJobResp = await this.modifyDtsJobWithOptions(modifyDtsJobReq, runtime);