@alicloud/esa20240910 2.34.2 → 2.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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: {
@@ -2267,6 +2267,21 @@ export default class Client extends OpenApi {
2267
2267
  * @returns ExportRecordsResponse
2268
2268
  */
2269
2269
  exportRecords(request: $_model.ExportRecordsRequest): Promise<$_model.ExportRecordsResponse>;
2270
+ /**
2271
+ * 获取架构文件套餐使用情况
2272
+ *
2273
+ * @param request - GetApiSchemaUsageRequest
2274
+ * @param runtime - runtime options for this request RuntimeOptions
2275
+ * @returns GetApiSchemaUsageResponse
2276
+ */
2277
+ getApiSchemaUsageWithOptions(request: $_model.GetApiSchemaUsageRequest, runtime: $dara.RuntimeOptions): Promise<$_model.GetApiSchemaUsageResponse>;
2278
+ /**
2279
+ * 获取架构文件套餐使用情况
2280
+ *
2281
+ * @param request - GetApiSchemaUsageRequest
2282
+ * @returns GetApiSchemaUsageResponse
2283
+ */
2284
+ getApiSchemaUsage(request: $_model.GetApiSchemaUsageRequest): Promise<$_model.GetApiSchemaUsageResponse>;
2270
2285
  /**
2271
2286
  * Queries the available specifications of cache reserve instances.
2272
2287
  *
package/dist/client.js CHANGED
@@ -49,37 +49,81 @@ class Client extends openapi_core_1.default {
49
49
  this.checkConfig(config);
50
50
  this._endpoint = this.getEndpoint("esa", this._regionId, this._endpointRule, this._network, this._suffix, this._endpointMap, this._endpoint);
51
51
  }
52
- async _postOSSObject(bucketName, form) {
53
- let request_ = new $dara.Request();
54
- let boundary = $dara.Form.getBoundary();
55
- request_.protocol = "HTTPS";
56
- request_.method = "POST";
57
- request_.pathname = `/`;
58
- request_.headers = {
59
- host: String(form["host"]),
60
- date: openapi_core_2.OpenApiUtil.getDateUTCString(),
61
- 'user-agent': openapi_core_2.OpenApiUtil.getUserAgent(""),
52
+ async _postOSSObject(bucketName, form, runtime) {
53
+ let _runtime = {
54
+ key: runtime.key || this._key,
55
+ cert: runtime.cert || this._cert,
56
+ ca: runtime.ca || this._ca,
57
+ readTimeout: runtime.readTimeout || this._readTimeout,
58
+ connectTimeout: runtime.connectTimeout || this._connectTimeout,
59
+ httpProxy: runtime.httpProxy || this._httpProxy,
60
+ httpsProxy: runtime.httpsProxy || this._httpsProxy,
61
+ noProxy: runtime.noProxy || this._noProxy,
62
+ socks5Proxy: runtime.socks5Proxy || this._socks5Proxy,
63
+ socks5NetWork: runtime.socks5NetWork || this._socks5NetWork,
64
+ maxIdleConns: runtime.maxIdleConns || this._maxIdleConns,
65
+ retryOptions: this._retryOptions,
66
+ ignoreSSL: runtime.ignoreSSL || false,
67
+ tlsMinVersion: this._tlsMinVersion,
62
68
  };
63
- request_.headers["content-type"] = `multipart/form-data; boundary=${boundary}`;
64
- request_.body = $dara.Form.toFileForm(form, boundary);
65
- let response_ = await $dara.doAction(request_);
66
- let respMap = null;
67
- let bodyStr = await $dara.Stream.readAsString(response_.body);
68
- if ((response_.statusCode >= 400) && (response_.statusCode < 600)) {
69
- respMap = $dara.XML.parseXml(bodyStr, null);
70
- let err = respMap["Error"];
71
- throw new $OpenApi.ClientError({
72
- code: String(err["Code"]),
73
- message: String(err["Message"]),
74
- data: {
75
- httpCode: response_.statusCode,
76
- requestId: String(err["RequestId"]),
77
- hostId: String(err["HostId"]),
78
- },
79
- });
80
- }
81
- respMap = $dara.XML.parseXml(bodyStr, null);
82
- return Object.assign({}, respMap);
69
+ let _retriesAttempted = 0;
70
+ let _lastRequest = null, _lastResponse = null;
71
+ let _context = new $dara.RetryPolicyContext({
72
+ retriesAttempted: _retriesAttempted,
73
+ });
74
+ while ($dara.shouldRetry(_runtime['retryOptions'], _context)) {
75
+ if (_retriesAttempted > 0) {
76
+ let _backoffTime = $dara.getBackoffDelay(_runtime['retryOptions'], _context);
77
+ if (_backoffTime > 0) {
78
+ await $dara.sleep(_backoffTime);
79
+ }
80
+ }
81
+ _retriesAttempted = _retriesAttempted + 1;
82
+ try {
83
+ let request_ = new $dara.Request();
84
+ let boundary = $dara.Form.getBoundary();
85
+ request_.protocol = "HTTPS";
86
+ request_.method = "POST";
87
+ request_.pathname = `/`;
88
+ request_.headers = {
89
+ host: String(form["host"]),
90
+ date: openapi_core_2.OpenApiUtil.getDateUTCString(),
91
+ 'user-agent': openapi_core_2.OpenApiUtil.getUserAgent(""),
92
+ };
93
+ request_.headers["content-type"] = `multipart/form-data; boundary=${boundary}`;
94
+ request_.body = $dara.Form.toFileForm(form, boundary);
95
+ _lastRequest = request_;
96
+ let response_ = await $dara.doAction(request_, _runtime);
97
+ _lastResponse = response_;
98
+ let respMap = null;
99
+ let bodyStr = await $dara.Stream.readAsString(response_.body);
100
+ if ((response_.statusCode >= 400) && (response_.statusCode < 600)) {
101
+ respMap = $dara.XML.parseXml(bodyStr, null);
102
+ let err = respMap["Error"];
103
+ throw new $OpenApi.ClientError({
104
+ code: String(err["Code"]),
105
+ message: String(err["Message"]),
106
+ data: {
107
+ httpCode: response_.statusCode,
108
+ requestId: String(err["RequestId"]),
109
+ hostId: String(err["HostId"]),
110
+ },
111
+ });
112
+ }
113
+ respMap = $dara.XML.parseXml(bodyStr, null);
114
+ return Object.assign({}, respMap);
115
+ }
116
+ catch (ex) {
117
+ _context = new $dara.RetryPolicyContext({
118
+ retriesAttempted: _retriesAttempted,
119
+ httpRequest: _lastRequest,
120
+ httpResponse: _lastResponse,
121
+ exception: ex,
122
+ });
123
+ continue;
124
+ }
125
+ }
126
+ throw $dara.newUnretryableError(_context);
83
127
  }
84
128
  getEndpoint(productId, regionId, endpointRule, network, suffix, endpointMap, endpoint) {
85
129
  if (!$dara.isNull(endpoint)) {
@@ -560,7 +604,7 @@ class Client extends openapi_core_1.default {
560
604
  file: fileObj,
561
605
  success_action_status: "201",
562
606
  };
563
- await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
607
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader, runtime);
564
608
  batchDeleteKvWithHighCapacityReq.url = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
565
609
  }
566
610
  let batchDeleteKvWithHighCapacityResp = await this.batchDeleteKvWithHighCapacityWithOptions(batchDeleteKvWithHighCapacityReq, runtime);
@@ -883,7 +927,7 @@ class Client extends openapi_core_1.default {
883
927
  file: fileObj,
884
928
  success_action_status: "201",
885
929
  };
886
- await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
930
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader, runtime);
887
931
  batchPutKvWithHighCapacityReq.url = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
888
932
  }
889
933
  let batchPutKvWithHighCapacityResp = await this.batchPutKvWithHighCapacityWithOptions(batchPutKvWithHighCapacityReq, runtime);
@@ -7023,6 +7067,48 @@ class Client extends openapi_core_1.default {
7023
7067
  let runtime = new $dara.RuntimeOptions({});
7024
7068
  return await this.exportRecordsWithOptions(request, runtime);
7025
7069
  }
7070
+ /**
7071
+ * 获取架构文件套餐使用情况
7072
+ *
7073
+ * @param request - GetApiSchemaUsageRequest
7074
+ * @param runtime - runtime options for this request RuntimeOptions
7075
+ * @returns GetApiSchemaUsageResponse
7076
+ */
7077
+ async getApiSchemaUsageWithOptions(request, runtime) {
7078
+ request.validate();
7079
+ let query = {};
7080
+ if (!$dara.isNull(request.siteId)) {
7081
+ query["SiteId"] = request.siteId;
7082
+ }
7083
+ if (!$dara.isNull(request.siteVersion)) {
7084
+ query["SiteVersion"] = request.siteVersion;
7085
+ }
7086
+ let req = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
7087
+ query: openapi_core_2.OpenApiUtil.query(query),
7088
+ });
7089
+ let params = new openapi_core_2.$OpenApiUtil.Params({
7090
+ action: "GetApiSchemaUsage",
7091
+ version: "2024-09-10",
7092
+ protocol: "HTTPS",
7093
+ pathname: "/",
7094
+ method: "POST",
7095
+ authType: "AK",
7096
+ style: "RPC",
7097
+ reqBodyType: "formData",
7098
+ bodyType: "json",
7099
+ });
7100
+ return $dara.cast(await this.callApi(params, req, runtime), new $_model.GetApiSchemaUsageResponse({}));
7101
+ }
7102
+ /**
7103
+ * 获取架构文件套餐使用情况
7104
+ *
7105
+ * @param request - GetApiSchemaUsageRequest
7106
+ * @returns GetApiSchemaUsageResponse
7107
+ */
7108
+ async getApiSchemaUsage(request) {
7109
+ let runtime = new $dara.RuntimeOptions({});
7110
+ return await this.getApiSchemaUsageWithOptions(request, runtime);
7111
+ }
7026
7112
  /**
7027
7113
  * Queries the available specifications of cache reserve instances.
7028
7114
  *
@@ -13297,7 +13383,7 @@ class Client extends openapi_core_1.default {
13297
13383
  file: fileObj,
13298
13384
  success_action_status: "201",
13299
13385
  };
13300
- await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
13386
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader, runtime);
13301
13387
  putKvWithHighCapacityReq.url = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
13302
13388
  }
13303
13389
  let putKvWithHighCapacityResp = await this.putKvWithHighCapacityWithOptions(putKvWithHighCapacityReq, runtime);
@@ -17270,7 +17356,7 @@ class Client extends openapi_core_1.default {
17270
17356
  file: fileObj,
17271
17357
  success_action_status: "201",
17272
17358
  };
17273
- await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
17359
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader, runtime);
17274
17360
  uploadFileReq.url = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
17275
17361
  }
17276
17362
  let uploadFileResp = await this.uploadFileWithOptions(uploadFileReq, runtime);