@nocobase/plugin-verification 1.5.0-alpha.1 → 1.5.0-alpha.3
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/externalVersion.js +6 -6
- package/dist/node_modules/@alicloud/dysmsapi20170525/dist/client.js +2 -2
- package/dist/node_modules/@alicloud/dysmsapi20170525/package.json +1 -1
- package/dist/node_modules/@alicloud/openapi-client/dist/client.d.ts +44 -0
- package/dist/node_modules/@alicloud/openapi-client/dist/client.js +2 -1
- package/dist/node_modules/@alicloud/openapi-client/package.json +1 -1
- package/dist/node_modules/@alicloud/openapi-client/src/client.ts +429 -51
- package/dist/node_modules/@alicloud/tea-util/package.json +1 -1
- package/dist/node_modules/tencentcloud-sdk-nodejs/package.json +1 -1
- package/package.json +3 -3
- package/dist/node_modules/@alicloud/dysmsapi20170525/node_modules/@alicloud/openapi-client/dist/client.d.ts +0 -291
- package/dist/node_modules/@alicloud/dysmsapi20170525/node_modules/@alicloud/openapi-client/dist/client.js +0 -1192
- package/dist/node_modules/@alicloud/dysmsapi20170525/node_modules/@alicloud/openapi-client/package.json +0 -37
- package/dist/node_modules/@alicloud/dysmsapi20170525/node_modules/@alicloud/openapi-client/src/client.ts +0 -1389
- /package/dist/node_modules/@alicloud/{dysmsapi20170525/node_modules/@alicloud/openapi-client → openapi-client}/node_modules/@alicloud/openapi-util/dist/client.d.ts +0 -0
- /package/dist/node_modules/@alicloud/{dysmsapi20170525/node_modules/@alicloud/openapi-client → openapi-client}/node_modules/@alicloud/openapi-util/dist/client.js +0 -0
- /package/dist/node_modules/@alicloud/{dysmsapi20170525/node_modules/@alicloud/openapi-client → openapi-client}/node_modules/@alicloud/openapi-util/package.json +0 -0
- /package/dist/node_modules/@alicloud/{dysmsapi20170525/node_modules/@alicloud/openapi-client → openapi-client}/node_modules/@alicloud/openapi-util/src/client.ts +0 -0
|
@@ -1,1389 +0,0 @@
|
|
|
1
|
-
// This file is auto-generated, don't edit it
|
|
2
|
-
/**
|
|
3
|
-
* This is for OpenApi SDK
|
|
4
|
-
*/
|
|
5
|
-
import Util, * as $Util from '@alicloud/tea-util';
|
|
6
|
-
import Credential, * as $Credential from '@alicloud/credentials';
|
|
7
|
-
import OpenApiUtil from '@alicloud/openapi-util';
|
|
8
|
-
import SPI, * as $SPI from '@alicloud/gateway-spi';
|
|
9
|
-
import XML from '@alicloud/tea-xml';
|
|
10
|
-
import { Readable } from 'stream';
|
|
11
|
-
import * as $tea from '@alicloud/tea-typescript';
|
|
12
|
-
|
|
13
|
-
export class GlobalParameters extends $tea.Model {
|
|
14
|
-
headers?: { [key: string]: string };
|
|
15
|
-
queries?: { [key: string]: string };
|
|
16
|
-
static names(): { [key: string]: string } {
|
|
17
|
-
return {
|
|
18
|
-
headers: 'headers',
|
|
19
|
-
queries: 'queries',
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static types(): { [key: string]: any } {
|
|
24
|
-
return {
|
|
25
|
-
headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
|
|
26
|
-
queries: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
constructor(map?: { [key: string]: any }) {
|
|
31
|
-
super(map);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Model for initing client
|
|
37
|
-
*/
|
|
38
|
-
export class Config extends $tea.Model {
|
|
39
|
-
accessKeyId?: string;
|
|
40
|
-
accessKeySecret?: string;
|
|
41
|
-
securityToken?: string;
|
|
42
|
-
protocol?: string;
|
|
43
|
-
method?: string;
|
|
44
|
-
regionId?: string;
|
|
45
|
-
readTimeout?: number;
|
|
46
|
-
connectTimeout?: number;
|
|
47
|
-
httpProxy?: string;
|
|
48
|
-
httpsProxy?: string;
|
|
49
|
-
credential?: Credential;
|
|
50
|
-
endpoint?: string;
|
|
51
|
-
noProxy?: string;
|
|
52
|
-
maxIdleConns?: number;
|
|
53
|
-
network?: string;
|
|
54
|
-
userAgent?: string;
|
|
55
|
-
suffix?: string;
|
|
56
|
-
socks5Proxy?: string;
|
|
57
|
-
socks5NetWork?: string;
|
|
58
|
-
endpointType?: string;
|
|
59
|
-
openPlatformEndpoint?: string;
|
|
60
|
-
type?: string;
|
|
61
|
-
signatureVersion?: string;
|
|
62
|
-
signatureAlgorithm?: string;
|
|
63
|
-
globalParameters?: GlobalParameters;
|
|
64
|
-
key?: string;
|
|
65
|
-
cert?: string;
|
|
66
|
-
ca?: string;
|
|
67
|
-
static names(): { [key: string]: string } {
|
|
68
|
-
return {
|
|
69
|
-
accessKeyId: 'accessKeyId',
|
|
70
|
-
accessKeySecret: 'accessKeySecret',
|
|
71
|
-
securityToken: 'securityToken',
|
|
72
|
-
protocol: 'protocol',
|
|
73
|
-
method: 'method',
|
|
74
|
-
regionId: 'regionId',
|
|
75
|
-
readTimeout: 'readTimeout',
|
|
76
|
-
connectTimeout: 'connectTimeout',
|
|
77
|
-
httpProxy: 'httpProxy',
|
|
78
|
-
httpsProxy: 'httpsProxy',
|
|
79
|
-
credential: 'credential',
|
|
80
|
-
endpoint: 'endpoint',
|
|
81
|
-
noProxy: 'noProxy',
|
|
82
|
-
maxIdleConns: 'maxIdleConns',
|
|
83
|
-
network: 'network',
|
|
84
|
-
userAgent: 'userAgent',
|
|
85
|
-
suffix: 'suffix',
|
|
86
|
-
socks5Proxy: 'socks5Proxy',
|
|
87
|
-
socks5NetWork: 'socks5NetWork',
|
|
88
|
-
endpointType: 'endpointType',
|
|
89
|
-
openPlatformEndpoint: 'openPlatformEndpoint',
|
|
90
|
-
type: 'type',
|
|
91
|
-
signatureVersion: 'signatureVersion',
|
|
92
|
-
signatureAlgorithm: 'signatureAlgorithm',
|
|
93
|
-
globalParameters: 'globalParameters',
|
|
94
|
-
key: 'key',
|
|
95
|
-
cert: 'cert',
|
|
96
|
-
ca: 'ca',
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
static types(): { [key: string]: any } {
|
|
101
|
-
return {
|
|
102
|
-
accessKeyId: 'string',
|
|
103
|
-
accessKeySecret: 'string',
|
|
104
|
-
securityToken: 'string',
|
|
105
|
-
protocol: 'string',
|
|
106
|
-
method: 'string',
|
|
107
|
-
regionId: 'string',
|
|
108
|
-
readTimeout: 'number',
|
|
109
|
-
connectTimeout: 'number',
|
|
110
|
-
httpProxy: 'string',
|
|
111
|
-
httpsProxy: 'string',
|
|
112
|
-
credential: Credential,
|
|
113
|
-
endpoint: 'string',
|
|
114
|
-
noProxy: 'string',
|
|
115
|
-
maxIdleConns: 'number',
|
|
116
|
-
network: 'string',
|
|
117
|
-
userAgent: 'string',
|
|
118
|
-
suffix: 'string',
|
|
119
|
-
socks5Proxy: 'string',
|
|
120
|
-
socks5NetWork: 'string',
|
|
121
|
-
endpointType: 'string',
|
|
122
|
-
openPlatformEndpoint: 'string',
|
|
123
|
-
type: 'string',
|
|
124
|
-
signatureVersion: 'string',
|
|
125
|
-
signatureAlgorithm: 'string',
|
|
126
|
-
globalParameters: GlobalParameters,
|
|
127
|
-
key: 'string',
|
|
128
|
-
cert: 'string',
|
|
129
|
-
ca: 'string',
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
constructor(map?: { [key: string]: any }) {
|
|
134
|
-
super(map);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export class OpenApiRequest extends $tea.Model {
|
|
139
|
-
headers?: { [key: string]: string };
|
|
140
|
-
query?: { [key: string]: string };
|
|
141
|
-
body?: any;
|
|
142
|
-
stream?: Readable;
|
|
143
|
-
hostMap?: { [key: string]: string };
|
|
144
|
-
endpointOverride?: string;
|
|
145
|
-
static names(): { [key: string]: string } {
|
|
146
|
-
return {
|
|
147
|
-
headers: 'headers',
|
|
148
|
-
query: 'query',
|
|
149
|
-
body: 'body',
|
|
150
|
-
stream: 'stream',
|
|
151
|
-
hostMap: 'hostMap',
|
|
152
|
-
endpointOverride: 'endpointOverride',
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
static types(): { [key: string]: any } {
|
|
157
|
-
return {
|
|
158
|
-
headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
|
|
159
|
-
query: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
|
|
160
|
-
body: 'any',
|
|
161
|
-
stream: 'Readable',
|
|
162
|
-
hostMap: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
|
|
163
|
-
endpointOverride: 'string',
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
constructor(map?: { [key: string]: any }) {
|
|
168
|
-
super(map);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export class Params extends $tea.Model {
|
|
173
|
-
action: string;
|
|
174
|
-
version: string;
|
|
175
|
-
protocol: string;
|
|
176
|
-
pathname: string;
|
|
177
|
-
method: string;
|
|
178
|
-
authType: string;
|
|
179
|
-
bodyType: string;
|
|
180
|
-
reqBodyType: string;
|
|
181
|
-
style?: string;
|
|
182
|
-
static names(): { [key: string]: string } {
|
|
183
|
-
return {
|
|
184
|
-
action: 'action',
|
|
185
|
-
version: 'version',
|
|
186
|
-
protocol: 'protocol',
|
|
187
|
-
pathname: 'pathname',
|
|
188
|
-
method: 'method',
|
|
189
|
-
authType: 'authType',
|
|
190
|
-
bodyType: 'bodyType',
|
|
191
|
-
reqBodyType: 'reqBodyType',
|
|
192
|
-
style: 'style',
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
static types(): { [key: string]: any } {
|
|
197
|
-
return {
|
|
198
|
-
action: 'string',
|
|
199
|
-
version: 'string',
|
|
200
|
-
protocol: 'string',
|
|
201
|
-
pathname: 'string',
|
|
202
|
-
method: 'string',
|
|
203
|
-
authType: 'string',
|
|
204
|
-
bodyType: 'string',
|
|
205
|
-
reqBodyType: 'string',
|
|
206
|
-
style: 'string',
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
constructor(map?: { [key: string]: any }) {
|
|
211
|
-
super(map);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
export default class Client {
|
|
217
|
-
_endpoint: string;
|
|
218
|
-
_regionId: string;
|
|
219
|
-
_protocol: string;
|
|
220
|
-
_method: string;
|
|
221
|
-
_userAgent: string;
|
|
222
|
-
_endpointRule: string;
|
|
223
|
-
_endpointMap: {[key: string ]: string};
|
|
224
|
-
_suffix: string;
|
|
225
|
-
_readTimeout: number;
|
|
226
|
-
_connectTimeout: number;
|
|
227
|
-
_httpProxy: string;
|
|
228
|
-
_httpsProxy: string;
|
|
229
|
-
_socks5Proxy: string;
|
|
230
|
-
_socks5NetWork: string;
|
|
231
|
-
_noProxy: string;
|
|
232
|
-
_network: string;
|
|
233
|
-
_productId: string;
|
|
234
|
-
_maxIdleConns: number;
|
|
235
|
-
_endpointType: string;
|
|
236
|
-
_openPlatformEndpoint: string;
|
|
237
|
-
_credential: Credential;
|
|
238
|
-
_signatureVersion: string;
|
|
239
|
-
_signatureAlgorithm: string;
|
|
240
|
-
_headers: {[key: string ]: string};
|
|
241
|
-
_spi: SPI;
|
|
242
|
-
_globalParameters: GlobalParameters;
|
|
243
|
-
_key: string;
|
|
244
|
-
_cert: string;
|
|
245
|
-
_ca: string;
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Init client with Config
|
|
249
|
-
* @param config config contains the necessary information to create a client
|
|
250
|
-
*/
|
|
251
|
-
constructor(config: Config) {
|
|
252
|
-
if (Util.isUnset(config)) {
|
|
253
|
-
throw $tea.newError({
|
|
254
|
-
code: "ParameterMissing",
|
|
255
|
-
message: "'config' can not be unset",
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (!Util.empty(config.accessKeyId) && !Util.empty(config.accessKeySecret)) {
|
|
260
|
-
if (!Util.empty(config.securityToken)) {
|
|
261
|
-
config.type = "sts";
|
|
262
|
-
} else {
|
|
263
|
-
config.type = "access_key";
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
let credentialConfig = new $Credential.Config({
|
|
267
|
-
accessKeyId: config.accessKeyId,
|
|
268
|
-
type: config.type,
|
|
269
|
-
accessKeySecret: config.accessKeySecret,
|
|
270
|
-
});
|
|
271
|
-
credentialConfig.securityToken = config.securityToken;
|
|
272
|
-
this._credential = new Credential(credentialConfig);
|
|
273
|
-
} else if (!Util.isUnset(config.credential)) {
|
|
274
|
-
this._credential = config.credential;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
this._endpoint = config.endpoint;
|
|
278
|
-
this._endpointType = config.endpointType;
|
|
279
|
-
this._network = config.network;
|
|
280
|
-
this._suffix = config.suffix;
|
|
281
|
-
this._protocol = config.protocol;
|
|
282
|
-
this._method = config.method;
|
|
283
|
-
this._regionId = config.regionId;
|
|
284
|
-
this._userAgent = config.userAgent;
|
|
285
|
-
this._readTimeout = config.readTimeout;
|
|
286
|
-
this._connectTimeout = config.connectTimeout;
|
|
287
|
-
this._httpProxy = config.httpProxy;
|
|
288
|
-
this._httpsProxy = config.httpsProxy;
|
|
289
|
-
this._noProxy = config.noProxy;
|
|
290
|
-
this._socks5Proxy = config.socks5Proxy;
|
|
291
|
-
this._socks5NetWork = config.socks5NetWork;
|
|
292
|
-
this._maxIdleConns = config.maxIdleConns;
|
|
293
|
-
this._signatureVersion = config.signatureVersion;
|
|
294
|
-
this._signatureAlgorithm = config.signatureAlgorithm;
|
|
295
|
-
this._globalParameters = config.globalParameters;
|
|
296
|
-
this._key = config.key;
|
|
297
|
-
this._cert = config.cert;
|
|
298
|
-
this._ca = config.ca;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Encapsulate the request and invoke the network
|
|
303
|
-
* @param action api name
|
|
304
|
-
* @param version product version
|
|
305
|
-
* @param protocol http or https
|
|
306
|
-
* @param method e.g. GET
|
|
307
|
-
* @param authType authorization type e.g. AK
|
|
308
|
-
* @param bodyType response body type e.g. String
|
|
309
|
-
* @param request object of OpenApiRequest
|
|
310
|
-
* @param runtime which controls some details of call api, such as retry times
|
|
311
|
-
* @return the response
|
|
312
|
-
*/
|
|
313
|
-
async doRPCRequest(action: string, version: string, protocol: string, method: string, authType: string, bodyType: string, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{[key: string]: any}> {
|
|
314
|
-
let _runtime: { [key: string]: any } = {
|
|
315
|
-
timeouted: "retry",
|
|
316
|
-
key: Util.defaultString(runtime.key, this._key),
|
|
317
|
-
cert: Util.defaultString(runtime.cert, this._cert),
|
|
318
|
-
ca: Util.defaultString(runtime.ca, this._ca),
|
|
319
|
-
readTimeout: Util.defaultNumber(runtime.readTimeout, this._readTimeout),
|
|
320
|
-
connectTimeout: Util.defaultNumber(runtime.connectTimeout, this._connectTimeout),
|
|
321
|
-
httpProxy: Util.defaultString(runtime.httpProxy, this._httpProxy),
|
|
322
|
-
httpsProxy: Util.defaultString(runtime.httpsProxy, this._httpsProxy),
|
|
323
|
-
noProxy: Util.defaultString(runtime.noProxy, this._noProxy),
|
|
324
|
-
socks5Proxy: Util.defaultString(runtime.socks5Proxy, this._socks5Proxy),
|
|
325
|
-
socks5NetWork: Util.defaultString(runtime.socks5NetWork, this._socks5NetWork),
|
|
326
|
-
maxIdleConns: Util.defaultNumber(runtime.maxIdleConns, this._maxIdleConns),
|
|
327
|
-
retry: {
|
|
328
|
-
retryable: runtime.autoretry,
|
|
329
|
-
maxAttempts: Util.defaultNumber(runtime.maxAttempts, 3),
|
|
330
|
-
},
|
|
331
|
-
backoff: {
|
|
332
|
-
policy: Util.defaultString(runtime.backoffPolicy, "no"),
|
|
333
|
-
period: Util.defaultNumber(runtime.backoffPeriod, 1),
|
|
334
|
-
},
|
|
335
|
-
ignoreSSL: runtime.ignoreSSL,
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
let _lastRequest = null;
|
|
339
|
-
let _now = Date.now();
|
|
340
|
-
let _retryTimes = 0;
|
|
341
|
-
while ($tea.allowRetry(_runtime['retry'], _retryTimes, _now)) {
|
|
342
|
-
if (_retryTimes > 0) {
|
|
343
|
-
let _backoffTime = $tea.getBackoffTime(_runtime['backoff'], _retryTimes);
|
|
344
|
-
if (_backoffTime > 0) {
|
|
345
|
-
await $tea.sleep(_backoffTime);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
_retryTimes = _retryTimes + 1;
|
|
350
|
-
try {
|
|
351
|
-
let request_ = new $tea.Request();
|
|
352
|
-
request_.protocol = Util.defaultString(this._protocol, protocol);
|
|
353
|
-
request_.method = method;
|
|
354
|
-
request_.pathname = "/";
|
|
355
|
-
let globalQueries : {[key: string ]: string} = { };
|
|
356
|
-
let globalHeaders : {[key: string ]: string} = { };
|
|
357
|
-
if (!Util.isUnset(this._globalParameters)) {
|
|
358
|
-
let globalParams = this._globalParameters;
|
|
359
|
-
if (!Util.isUnset(globalParams.queries)) {
|
|
360
|
-
globalQueries = globalParams.queries;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
if (!Util.isUnset(globalParams.headers)) {
|
|
364
|
-
globalHeaders = globalParams.headers;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
request_.query = {
|
|
370
|
-
Action: action,
|
|
371
|
-
Format: "json",
|
|
372
|
-
Version: version,
|
|
373
|
-
Timestamp: OpenApiUtil.getTimestamp(),
|
|
374
|
-
SignatureNonce: Util.getNonce(),
|
|
375
|
-
...globalQueries,
|
|
376
|
-
...request.query,
|
|
377
|
-
};
|
|
378
|
-
let headers = this.getRpcHeaders();
|
|
379
|
-
if (Util.isUnset(headers)) {
|
|
380
|
-
// endpoint is setted in product client
|
|
381
|
-
request_.headers = {
|
|
382
|
-
host: this._endpoint,
|
|
383
|
-
'x-acs-version': version,
|
|
384
|
-
'x-acs-action': action,
|
|
385
|
-
'user-agent': this.getUserAgent(),
|
|
386
|
-
...globalHeaders,
|
|
387
|
-
};
|
|
388
|
-
} else {
|
|
389
|
-
request_.headers = {
|
|
390
|
-
host: this._endpoint,
|
|
391
|
-
'x-acs-version': version,
|
|
392
|
-
'x-acs-action': action,
|
|
393
|
-
'user-agent': this.getUserAgent(),
|
|
394
|
-
...globalHeaders,
|
|
395
|
-
...headers,
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
if (!Util.isUnset(request.body)) {
|
|
400
|
-
let m = Util.assertAsMap(request.body);
|
|
401
|
-
let tmp = Util.anyifyMapValue(OpenApiUtil.query(m));
|
|
402
|
-
request_.body = new $tea.BytesReadable(Util.toFormString(tmp));
|
|
403
|
-
request_.headers["content-type"] = "application/x-www-form-urlencoded";
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
if (!Util.equalString(authType, "Anonymous")) {
|
|
407
|
-
let accessKeyId = await this.getAccessKeyId();
|
|
408
|
-
let accessKeySecret = await this.getAccessKeySecret();
|
|
409
|
-
let securityToken = await this.getSecurityToken();
|
|
410
|
-
if (!Util.empty(securityToken)) {
|
|
411
|
-
request_.query["SecurityToken"] = securityToken;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
request_.query["SignatureMethod"] = "HMAC-SHA1";
|
|
415
|
-
request_.query["SignatureVersion"] = "1.0";
|
|
416
|
-
request_.query["AccessKeyId"] = accessKeyId;
|
|
417
|
-
let t : {[key: string ]: any} = null;
|
|
418
|
-
if (!Util.isUnset(request.body)) {
|
|
419
|
-
t = Util.assertAsMap(request.body);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
let signedParam = {
|
|
423
|
-
...request_.query,
|
|
424
|
-
...OpenApiUtil.query(t),
|
|
425
|
-
};
|
|
426
|
-
request_.query["Signature"] = OpenApiUtil.getRPCSignature(signedParam, request_.method, accessKeySecret);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
_lastRequest = request_;
|
|
430
|
-
let response_ = await $tea.doAction(request_, _runtime);
|
|
431
|
-
|
|
432
|
-
if (Util.is4xx(response_.statusCode) || Util.is5xx(response_.statusCode)) {
|
|
433
|
-
let _res = await Util.readAsJSON(response_.body);
|
|
434
|
-
let err = Util.assertAsMap(_res);
|
|
435
|
-
let requestId = Client.defaultAny(err["RequestId"], err["requestId"]);
|
|
436
|
-
err["statusCode"] = response_.statusCode;
|
|
437
|
-
throw $tea.newError({
|
|
438
|
-
code: `${Client.defaultAny(err["Code"], err["code"])}`,
|
|
439
|
-
message: `code: ${response_.statusCode}, ${Client.defaultAny(err["Message"], err["message"])} request id: ${requestId}`,
|
|
440
|
-
data: err,
|
|
441
|
-
description: `${Client.defaultAny(err["Description"], err["description"])}`,
|
|
442
|
-
accessDeniedDetail: Client.defaultAny(err["AccessDeniedDetail"], err["accessDeniedDetail"]),
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
if (Util.equalString(bodyType, "binary")) {
|
|
447
|
-
let resp = {
|
|
448
|
-
body: response_.body,
|
|
449
|
-
headers: response_.headers,
|
|
450
|
-
statusCode: response_.statusCode,
|
|
451
|
-
};
|
|
452
|
-
return resp;
|
|
453
|
-
} else if (Util.equalString(bodyType, "byte")) {
|
|
454
|
-
let byt = await Util.readAsBytes(response_.body);
|
|
455
|
-
return {
|
|
456
|
-
body: byt,
|
|
457
|
-
headers: response_.headers,
|
|
458
|
-
statusCode: response_.statusCode,
|
|
459
|
-
};
|
|
460
|
-
} else if (Util.equalString(bodyType, "string")) {
|
|
461
|
-
let str = await Util.readAsString(response_.body);
|
|
462
|
-
return {
|
|
463
|
-
body: str,
|
|
464
|
-
headers: response_.headers,
|
|
465
|
-
statusCode: response_.statusCode,
|
|
466
|
-
};
|
|
467
|
-
} else if (Util.equalString(bodyType, "json")) {
|
|
468
|
-
let obj = await Util.readAsJSON(response_.body);
|
|
469
|
-
let res = Util.assertAsMap(obj);
|
|
470
|
-
return {
|
|
471
|
-
body: res,
|
|
472
|
-
headers: response_.headers,
|
|
473
|
-
statusCode: response_.statusCode,
|
|
474
|
-
};
|
|
475
|
-
} else if (Util.equalString(bodyType, "array")) {
|
|
476
|
-
let arr = await Util.readAsJSON(response_.body);
|
|
477
|
-
return {
|
|
478
|
-
body: arr,
|
|
479
|
-
headers: response_.headers,
|
|
480
|
-
statusCode: response_.statusCode,
|
|
481
|
-
};
|
|
482
|
-
} else {
|
|
483
|
-
return {
|
|
484
|
-
headers: response_.headers,
|
|
485
|
-
statusCode: response_.statusCode,
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
} catch (ex) {
|
|
490
|
-
if ($tea.isRetryable(ex)) {
|
|
491
|
-
continue;
|
|
492
|
-
}
|
|
493
|
-
throw ex;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
throw $tea.newUnretryableError(_lastRequest);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
/**
|
|
501
|
-
* Encapsulate the request and invoke the network
|
|
502
|
-
* @param action api name
|
|
503
|
-
* @param version product version
|
|
504
|
-
* @param protocol http or https
|
|
505
|
-
* @param method e.g. GET
|
|
506
|
-
* @param authType authorization type e.g. AK
|
|
507
|
-
* @param pathname pathname of every api
|
|
508
|
-
* @param bodyType response body type e.g. String
|
|
509
|
-
* @param request object of OpenApiRequest
|
|
510
|
-
* @param runtime which controls some details of call api, such as retry times
|
|
511
|
-
* @return the response
|
|
512
|
-
*/
|
|
513
|
-
async doROARequest(action: string, version: string, protocol: string, method: string, authType: string, pathname: string, bodyType: string, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{[key: string]: any}> {
|
|
514
|
-
let _runtime: { [key: string]: any } = {
|
|
515
|
-
timeouted: "retry",
|
|
516
|
-
key: Util.defaultString(runtime.key, this._key),
|
|
517
|
-
cert: Util.defaultString(runtime.cert, this._cert),
|
|
518
|
-
ca: Util.defaultString(runtime.ca, this._ca),
|
|
519
|
-
readTimeout: Util.defaultNumber(runtime.readTimeout, this._readTimeout),
|
|
520
|
-
connectTimeout: Util.defaultNumber(runtime.connectTimeout, this._connectTimeout),
|
|
521
|
-
httpProxy: Util.defaultString(runtime.httpProxy, this._httpProxy),
|
|
522
|
-
httpsProxy: Util.defaultString(runtime.httpsProxy, this._httpsProxy),
|
|
523
|
-
noProxy: Util.defaultString(runtime.noProxy, this._noProxy),
|
|
524
|
-
socks5Proxy: Util.defaultString(runtime.socks5Proxy, this._socks5Proxy),
|
|
525
|
-
socks5NetWork: Util.defaultString(runtime.socks5NetWork, this._socks5NetWork),
|
|
526
|
-
maxIdleConns: Util.defaultNumber(runtime.maxIdleConns, this._maxIdleConns),
|
|
527
|
-
retry: {
|
|
528
|
-
retryable: runtime.autoretry,
|
|
529
|
-
maxAttempts: Util.defaultNumber(runtime.maxAttempts, 3),
|
|
530
|
-
},
|
|
531
|
-
backoff: {
|
|
532
|
-
policy: Util.defaultString(runtime.backoffPolicy, "no"),
|
|
533
|
-
period: Util.defaultNumber(runtime.backoffPeriod, 1),
|
|
534
|
-
},
|
|
535
|
-
ignoreSSL: runtime.ignoreSSL,
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
let _lastRequest = null;
|
|
539
|
-
let _now = Date.now();
|
|
540
|
-
let _retryTimes = 0;
|
|
541
|
-
while ($tea.allowRetry(_runtime['retry'], _retryTimes, _now)) {
|
|
542
|
-
if (_retryTimes > 0) {
|
|
543
|
-
let _backoffTime = $tea.getBackoffTime(_runtime['backoff'], _retryTimes);
|
|
544
|
-
if (_backoffTime > 0) {
|
|
545
|
-
await $tea.sleep(_backoffTime);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
_retryTimes = _retryTimes + 1;
|
|
550
|
-
try {
|
|
551
|
-
let request_ = new $tea.Request();
|
|
552
|
-
request_.protocol = Util.defaultString(this._protocol, protocol);
|
|
553
|
-
request_.method = method;
|
|
554
|
-
request_.pathname = pathname;
|
|
555
|
-
let globalQueries : {[key: string ]: string} = { };
|
|
556
|
-
let globalHeaders : {[key: string ]: string} = { };
|
|
557
|
-
if (!Util.isUnset(this._globalParameters)) {
|
|
558
|
-
let globalParams = this._globalParameters;
|
|
559
|
-
if (!Util.isUnset(globalParams.queries)) {
|
|
560
|
-
globalQueries = globalParams.queries;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
if (!Util.isUnset(globalParams.headers)) {
|
|
564
|
-
globalHeaders = globalParams.headers;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
request_.headers = {
|
|
570
|
-
date: Util.getDateUTCString(),
|
|
571
|
-
host: this._endpoint,
|
|
572
|
-
accept: "application/json",
|
|
573
|
-
'x-acs-signature-nonce': Util.getNonce(),
|
|
574
|
-
'x-acs-signature-method': "HMAC-SHA1",
|
|
575
|
-
'x-acs-signature-version': "1.0",
|
|
576
|
-
'x-acs-version': version,
|
|
577
|
-
'x-acs-action': action,
|
|
578
|
-
'user-agent': Util.getUserAgent(this._userAgent),
|
|
579
|
-
...globalHeaders,
|
|
580
|
-
...request.headers,
|
|
581
|
-
};
|
|
582
|
-
if (!Util.isUnset(request.body)) {
|
|
583
|
-
request_.body = new $tea.BytesReadable(Util.toJSONString(request.body));
|
|
584
|
-
request_.headers["content-type"] = "application/json; charset=utf-8";
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
request_.query = globalQueries;
|
|
588
|
-
if (!Util.isUnset(request.query)) {
|
|
589
|
-
request_.query = {
|
|
590
|
-
...request_.query,
|
|
591
|
-
...request.query,
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
if (!Util.equalString(authType, "Anonymous")) {
|
|
596
|
-
let accessKeyId = await this.getAccessKeyId();
|
|
597
|
-
let accessKeySecret = await this.getAccessKeySecret();
|
|
598
|
-
let securityToken = await this.getSecurityToken();
|
|
599
|
-
if (!Util.empty(securityToken)) {
|
|
600
|
-
request_.headers["x-acs-accesskey-id"] = accessKeyId;
|
|
601
|
-
request_.headers["x-acs-security-token"] = securityToken;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
let stringToSign = OpenApiUtil.getStringToSign(request_);
|
|
605
|
-
request_.headers["authorization"] = `acs ${accessKeyId}:${OpenApiUtil.getROASignature(stringToSign, accessKeySecret)}`;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
_lastRequest = request_;
|
|
609
|
-
let response_ = await $tea.doAction(request_, _runtime);
|
|
610
|
-
|
|
611
|
-
if (Util.equalNumber(response_.statusCode, 204)) {
|
|
612
|
-
return {
|
|
613
|
-
headers: response_.headers,
|
|
614
|
-
};
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
if (Util.is4xx(response_.statusCode) || Util.is5xx(response_.statusCode)) {
|
|
618
|
-
let _res = await Util.readAsJSON(response_.body);
|
|
619
|
-
let err = Util.assertAsMap(_res);
|
|
620
|
-
let requestId = Client.defaultAny(err["RequestId"], err["requestId"]);
|
|
621
|
-
requestId = Client.defaultAny(requestId, err["requestid"]);
|
|
622
|
-
err["statusCode"] = response_.statusCode;
|
|
623
|
-
throw $tea.newError({
|
|
624
|
-
code: `${Client.defaultAny(err["Code"], err["code"])}`,
|
|
625
|
-
message: `code: ${response_.statusCode}, ${Client.defaultAny(err["Message"], err["message"])} request id: ${requestId}`,
|
|
626
|
-
data: err,
|
|
627
|
-
description: `${Client.defaultAny(err["Description"], err["description"])}`,
|
|
628
|
-
accessDeniedDetail: Client.defaultAny(err["AccessDeniedDetail"], err["accessDeniedDetail"]),
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
if (Util.equalString(bodyType, "binary")) {
|
|
633
|
-
let resp = {
|
|
634
|
-
body: response_.body,
|
|
635
|
-
headers: response_.headers,
|
|
636
|
-
statusCode: response_.statusCode,
|
|
637
|
-
};
|
|
638
|
-
return resp;
|
|
639
|
-
} else if (Util.equalString(bodyType, "byte")) {
|
|
640
|
-
let byt = await Util.readAsBytes(response_.body);
|
|
641
|
-
return {
|
|
642
|
-
body: byt,
|
|
643
|
-
headers: response_.headers,
|
|
644
|
-
statusCode: response_.statusCode,
|
|
645
|
-
};
|
|
646
|
-
} else if (Util.equalString(bodyType, "string")) {
|
|
647
|
-
let str = await Util.readAsString(response_.body);
|
|
648
|
-
return {
|
|
649
|
-
body: str,
|
|
650
|
-
headers: response_.headers,
|
|
651
|
-
statusCode: response_.statusCode,
|
|
652
|
-
};
|
|
653
|
-
} else if (Util.equalString(bodyType, "json")) {
|
|
654
|
-
let obj = await Util.readAsJSON(response_.body);
|
|
655
|
-
let res = Util.assertAsMap(obj);
|
|
656
|
-
return {
|
|
657
|
-
body: res,
|
|
658
|
-
headers: response_.headers,
|
|
659
|
-
statusCode: response_.statusCode,
|
|
660
|
-
};
|
|
661
|
-
} else if (Util.equalString(bodyType, "array")) {
|
|
662
|
-
let arr = await Util.readAsJSON(response_.body);
|
|
663
|
-
return {
|
|
664
|
-
body: arr,
|
|
665
|
-
headers: response_.headers,
|
|
666
|
-
statusCode: response_.statusCode,
|
|
667
|
-
};
|
|
668
|
-
} else {
|
|
669
|
-
return {
|
|
670
|
-
headers: response_.headers,
|
|
671
|
-
statusCode: response_.statusCode,
|
|
672
|
-
};
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
} catch (ex) {
|
|
676
|
-
if ($tea.isRetryable(ex)) {
|
|
677
|
-
continue;
|
|
678
|
-
}
|
|
679
|
-
throw ex;
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
throw $tea.newUnretryableError(_lastRequest);
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
/**
|
|
687
|
-
* Encapsulate the request and invoke the network with form body
|
|
688
|
-
* @param action api name
|
|
689
|
-
* @param version product version
|
|
690
|
-
* @param protocol http or https
|
|
691
|
-
* @param method e.g. GET
|
|
692
|
-
* @param authType authorization type e.g. AK
|
|
693
|
-
* @param pathname pathname of every api
|
|
694
|
-
* @param bodyType response body type e.g. String
|
|
695
|
-
* @param request object of OpenApiRequest
|
|
696
|
-
* @param runtime which controls some details of call api, such as retry times
|
|
697
|
-
* @return the response
|
|
698
|
-
*/
|
|
699
|
-
async doROARequestWithForm(action: string, version: string, protocol: string, method: string, authType: string, pathname: string, bodyType: string, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{[key: string]: any}> {
|
|
700
|
-
let _runtime: { [key: string]: any } = {
|
|
701
|
-
timeouted: "retry",
|
|
702
|
-
key: Util.defaultString(runtime.key, this._key),
|
|
703
|
-
cert: Util.defaultString(runtime.cert, this._cert),
|
|
704
|
-
ca: Util.defaultString(runtime.ca, this._ca),
|
|
705
|
-
readTimeout: Util.defaultNumber(runtime.readTimeout, this._readTimeout),
|
|
706
|
-
connectTimeout: Util.defaultNumber(runtime.connectTimeout, this._connectTimeout),
|
|
707
|
-
httpProxy: Util.defaultString(runtime.httpProxy, this._httpProxy),
|
|
708
|
-
httpsProxy: Util.defaultString(runtime.httpsProxy, this._httpsProxy),
|
|
709
|
-
noProxy: Util.defaultString(runtime.noProxy, this._noProxy),
|
|
710
|
-
socks5Proxy: Util.defaultString(runtime.socks5Proxy, this._socks5Proxy),
|
|
711
|
-
socks5NetWork: Util.defaultString(runtime.socks5NetWork, this._socks5NetWork),
|
|
712
|
-
maxIdleConns: Util.defaultNumber(runtime.maxIdleConns, this._maxIdleConns),
|
|
713
|
-
retry: {
|
|
714
|
-
retryable: runtime.autoretry,
|
|
715
|
-
maxAttempts: Util.defaultNumber(runtime.maxAttempts, 3),
|
|
716
|
-
},
|
|
717
|
-
backoff: {
|
|
718
|
-
policy: Util.defaultString(runtime.backoffPolicy, "no"),
|
|
719
|
-
period: Util.defaultNumber(runtime.backoffPeriod, 1),
|
|
720
|
-
},
|
|
721
|
-
ignoreSSL: runtime.ignoreSSL,
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
let _lastRequest = null;
|
|
725
|
-
let _now = Date.now();
|
|
726
|
-
let _retryTimes = 0;
|
|
727
|
-
while ($tea.allowRetry(_runtime['retry'], _retryTimes, _now)) {
|
|
728
|
-
if (_retryTimes > 0) {
|
|
729
|
-
let _backoffTime = $tea.getBackoffTime(_runtime['backoff'], _retryTimes);
|
|
730
|
-
if (_backoffTime > 0) {
|
|
731
|
-
await $tea.sleep(_backoffTime);
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
_retryTimes = _retryTimes + 1;
|
|
736
|
-
try {
|
|
737
|
-
let request_ = new $tea.Request();
|
|
738
|
-
request_.protocol = Util.defaultString(this._protocol, protocol);
|
|
739
|
-
request_.method = method;
|
|
740
|
-
request_.pathname = pathname;
|
|
741
|
-
let globalQueries : {[key: string ]: string} = { };
|
|
742
|
-
let globalHeaders : {[key: string ]: string} = { };
|
|
743
|
-
if (!Util.isUnset(this._globalParameters)) {
|
|
744
|
-
let globalParams = this._globalParameters;
|
|
745
|
-
if (!Util.isUnset(globalParams.queries)) {
|
|
746
|
-
globalQueries = globalParams.queries;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
if (!Util.isUnset(globalParams.headers)) {
|
|
750
|
-
globalHeaders = globalParams.headers;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
request_.headers = {
|
|
756
|
-
date: Util.getDateUTCString(),
|
|
757
|
-
host: this._endpoint,
|
|
758
|
-
accept: "application/json",
|
|
759
|
-
'x-acs-signature-nonce': Util.getNonce(),
|
|
760
|
-
'x-acs-signature-method': "HMAC-SHA1",
|
|
761
|
-
'x-acs-signature-version': "1.0",
|
|
762
|
-
'x-acs-version': version,
|
|
763
|
-
'x-acs-action': action,
|
|
764
|
-
'user-agent': Util.getUserAgent(this._userAgent),
|
|
765
|
-
...globalHeaders,
|
|
766
|
-
...request.headers,
|
|
767
|
-
};
|
|
768
|
-
if (!Util.isUnset(request.body)) {
|
|
769
|
-
let m = Util.assertAsMap(request.body);
|
|
770
|
-
request_.body = new $tea.BytesReadable(OpenApiUtil.toForm(m));
|
|
771
|
-
request_.headers["content-type"] = "application/x-www-form-urlencoded";
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
request_.query = globalQueries;
|
|
775
|
-
if (!Util.isUnset(request.query)) {
|
|
776
|
-
request_.query = {
|
|
777
|
-
...request_.query,
|
|
778
|
-
...request.query,
|
|
779
|
-
};
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
if (!Util.equalString(authType, "Anonymous")) {
|
|
783
|
-
let accessKeyId = await this.getAccessKeyId();
|
|
784
|
-
let accessKeySecret = await this.getAccessKeySecret();
|
|
785
|
-
let securityToken = await this.getSecurityToken();
|
|
786
|
-
if (!Util.empty(securityToken)) {
|
|
787
|
-
request_.headers["x-acs-accesskey-id"] = accessKeyId;
|
|
788
|
-
request_.headers["x-acs-security-token"] = securityToken;
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
let stringToSign = OpenApiUtil.getStringToSign(request_);
|
|
792
|
-
request_.headers["authorization"] = `acs ${accessKeyId}:${OpenApiUtil.getROASignature(stringToSign, accessKeySecret)}`;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
_lastRequest = request_;
|
|
796
|
-
let response_ = await $tea.doAction(request_, _runtime);
|
|
797
|
-
|
|
798
|
-
if (Util.equalNumber(response_.statusCode, 204)) {
|
|
799
|
-
return {
|
|
800
|
-
headers: response_.headers,
|
|
801
|
-
};
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
if (Util.is4xx(response_.statusCode) || Util.is5xx(response_.statusCode)) {
|
|
805
|
-
let _res = await Util.readAsJSON(response_.body);
|
|
806
|
-
let err = Util.assertAsMap(_res);
|
|
807
|
-
err["statusCode"] = response_.statusCode;
|
|
808
|
-
throw $tea.newError({
|
|
809
|
-
code: `${Client.defaultAny(err["Code"], err["code"])}`,
|
|
810
|
-
message: `code: ${response_.statusCode}, ${Client.defaultAny(err["Message"], err["message"])} request id: ${Client.defaultAny(err["RequestId"], err["requestId"])}`,
|
|
811
|
-
data: err,
|
|
812
|
-
description: `${Client.defaultAny(err["Description"], err["description"])}`,
|
|
813
|
-
accessDeniedDetail: Client.defaultAny(err["AccessDeniedDetail"], err["accessDeniedDetail"]),
|
|
814
|
-
});
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
if (Util.equalString(bodyType, "binary")) {
|
|
818
|
-
let resp = {
|
|
819
|
-
body: response_.body,
|
|
820
|
-
headers: response_.headers,
|
|
821
|
-
statusCode: response_.statusCode,
|
|
822
|
-
};
|
|
823
|
-
return resp;
|
|
824
|
-
} else if (Util.equalString(bodyType, "byte")) {
|
|
825
|
-
let byt = await Util.readAsBytes(response_.body);
|
|
826
|
-
return {
|
|
827
|
-
body: byt,
|
|
828
|
-
headers: response_.headers,
|
|
829
|
-
statusCode: response_.statusCode,
|
|
830
|
-
};
|
|
831
|
-
} else if (Util.equalString(bodyType, "string")) {
|
|
832
|
-
let str = await Util.readAsString(response_.body);
|
|
833
|
-
return {
|
|
834
|
-
body: str,
|
|
835
|
-
headers: response_.headers,
|
|
836
|
-
statusCode: response_.statusCode,
|
|
837
|
-
};
|
|
838
|
-
} else if (Util.equalString(bodyType, "json")) {
|
|
839
|
-
let obj = await Util.readAsJSON(response_.body);
|
|
840
|
-
let res = Util.assertAsMap(obj);
|
|
841
|
-
return {
|
|
842
|
-
body: res,
|
|
843
|
-
headers: response_.headers,
|
|
844
|
-
statusCode: response_.statusCode,
|
|
845
|
-
};
|
|
846
|
-
} else if (Util.equalString(bodyType, "array")) {
|
|
847
|
-
let arr = await Util.readAsJSON(response_.body);
|
|
848
|
-
return {
|
|
849
|
-
body: arr,
|
|
850
|
-
headers: response_.headers,
|
|
851
|
-
statusCode: response_.statusCode,
|
|
852
|
-
};
|
|
853
|
-
} else {
|
|
854
|
-
return {
|
|
855
|
-
headers: response_.headers,
|
|
856
|
-
statusCode: response_.statusCode,
|
|
857
|
-
};
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
} catch (ex) {
|
|
861
|
-
if ($tea.isRetryable(ex)) {
|
|
862
|
-
continue;
|
|
863
|
-
}
|
|
864
|
-
throw ex;
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
throw $tea.newUnretryableError(_lastRequest);
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
/**
|
|
872
|
-
* Encapsulate the request and invoke the network
|
|
873
|
-
* @param action api name
|
|
874
|
-
* @param version product version
|
|
875
|
-
* @param protocol http or https
|
|
876
|
-
* @param method e.g. GET
|
|
877
|
-
* @param authType authorization type e.g. AK
|
|
878
|
-
* @param bodyType response body type e.g. String
|
|
879
|
-
* @param request object of OpenApiRequest
|
|
880
|
-
* @param runtime which controls some details of call api, such as retry times
|
|
881
|
-
* @return the response
|
|
882
|
-
*/
|
|
883
|
-
async doRequest(params: Params, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{[key: string]: any}> {
|
|
884
|
-
let _runtime: { [key: string]: any } = {
|
|
885
|
-
timeouted: "retry",
|
|
886
|
-
key: Util.defaultString(runtime.key, this._key),
|
|
887
|
-
cert: Util.defaultString(runtime.cert, this._cert),
|
|
888
|
-
ca: Util.defaultString(runtime.ca, this._ca),
|
|
889
|
-
readTimeout: Util.defaultNumber(runtime.readTimeout, this._readTimeout),
|
|
890
|
-
connectTimeout: Util.defaultNumber(runtime.connectTimeout, this._connectTimeout),
|
|
891
|
-
httpProxy: Util.defaultString(runtime.httpProxy, this._httpProxy),
|
|
892
|
-
httpsProxy: Util.defaultString(runtime.httpsProxy, this._httpsProxy),
|
|
893
|
-
noProxy: Util.defaultString(runtime.noProxy, this._noProxy),
|
|
894
|
-
socks5Proxy: Util.defaultString(runtime.socks5Proxy, this._socks5Proxy),
|
|
895
|
-
socks5NetWork: Util.defaultString(runtime.socks5NetWork, this._socks5NetWork),
|
|
896
|
-
maxIdleConns: Util.defaultNumber(runtime.maxIdleConns, this._maxIdleConns),
|
|
897
|
-
retry: {
|
|
898
|
-
retryable: runtime.autoretry,
|
|
899
|
-
maxAttempts: Util.defaultNumber(runtime.maxAttempts, 3),
|
|
900
|
-
},
|
|
901
|
-
backoff: {
|
|
902
|
-
policy: Util.defaultString(runtime.backoffPolicy, "no"),
|
|
903
|
-
period: Util.defaultNumber(runtime.backoffPeriod, 1),
|
|
904
|
-
},
|
|
905
|
-
ignoreSSL: runtime.ignoreSSL,
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
let _lastRequest = null;
|
|
909
|
-
let _now = Date.now();
|
|
910
|
-
let _retryTimes = 0;
|
|
911
|
-
while ($tea.allowRetry(_runtime['retry'], _retryTimes, _now)) {
|
|
912
|
-
if (_retryTimes > 0) {
|
|
913
|
-
let _backoffTime = $tea.getBackoffTime(_runtime['backoff'], _retryTimes);
|
|
914
|
-
if (_backoffTime > 0) {
|
|
915
|
-
await $tea.sleep(_backoffTime);
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
_retryTimes = _retryTimes + 1;
|
|
920
|
-
try {
|
|
921
|
-
let request_ = new $tea.Request();
|
|
922
|
-
request_.protocol = Util.defaultString(this._protocol, params.protocol);
|
|
923
|
-
request_.method = params.method;
|
|
924
|
-
request_.pathname = params.pathname;
|
|
925
|
-
let globalQueries : {[key: string ]: string} = { };
|
|
926
|
-
let globalHeaders : {[key: string ]: string} = { };
|
|
927
|
-
if (!Util.isUnset(this._globalParameters)) {
|
|
928
|
-
let globalParams = this._globalParameters;
|
|
929
|
-
if (!Util.isUnset(globalParams.queries)) {
|
|
930
|
-
globalQueries = globalParams.queries;
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
if (!Util.isUnset(globalParams.headers)) {
|
|
934
|
-
globalHeaders = globalParams.headers;
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
request_.query = {
|
|
940
|
-
...globalQueries,
|
|
941
|
-
...request.query,
|
|
942
|
-
};
|
|
943
|
-
// endpoint is setted in product client
|
|
944
|
-
request_.headers = {
|
|
945
|
-
host: this._endpoint,
|
|
946
|
-
'x-acs-version': params.version,
|
|
947
|
-
'x-acs-action': params.action,
|
|
948
|
-
'user-agent': this.getUserAgent(),
|
|
949
|
-
'x-acs-date': OpenApiUtil.getTimestamp(),
|
|
950
|
-
'x-acs-signature-nonce': Util.getNonce(),
|
|
951
|
-
accept: "application/json",
|
|
952
|
-
...globalHeaders,
|
|
953
|
-
...request.headers,
|
|
954
|
-
};
|
|
955
|
-
if (Util.equalString(params.style, "RPC")) {
|
|
956
|
-
let headers = this.getRpcHeaders();
|
|
957
|
-
if (!Util.isUnset(headers)) {
|
|
958
|
-
request_.headers = {
|
|
959
|
-
...request_.headers,
|
|
960
|
-
...headers,
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
let signatureAlgorithm = Util.defaultString(this._signatureAlgorithm, "ACS3-HMAC-SHA256");
|
|
967
|
-
let hashedRequestPayload = OpenApiUtil.hexEncode(OpenApiUtil.hash(Util.toBytes(""), signatureAlgorithm));
|
|
968
|
-
if (!Util.isUnset(request.stream)) {
|
|
969
|
-
let tmp = await Util.readAsBytes(request.stream);
|
|
970
|
-
hashedRequestPayload = OpenApiUtil.hexEncode(OpenApiUtil.hash(tmp, signatureAlgorithm));
|
|
971
|
-
request_.body = new $tea.BytesReadable(tmp);
|
|
972
|
-
request_.headers["content-type"] = "application/octet-stream";
|
|
973
|
-
} else {
|
|
974
|
-
if (!Util.isUnset(request.body)) {
|
|
975
|
-
if (Util.equalString(params.reqBodyType, "byte")) {
|
|
976
|
-
let byteObj = Util.assertAsBytes(request.body);
|
|
977
|
-
hashedRequestPayload = OpenApiUtil.hexEncode(OpenApiUtil.hash(byteObj, signatureAlgorithm));
|
|
978
|
-
request_.body = new $tea.BytesReadable(byteObj);
|
|
979
|
-
} else if (Util.equalString(params.reqBodyType, "json")) {
|
|
980
|
-
let jsonObj = Util.toJSONString(request.body);
|
|
981
|
-
hashedRequestPayload = OpenApiUtil.hexEncode(OpenApiUtil.hash(Util.toBytes(jsonObj), signatureAlgorithm));
|
|
982
|
-
request_.body = new $tea.BytesReadable(jsonObj);
|
|
983
|
-
request_.headers["content-type"] = "application/json; charset=utf-8";
|
|
984
|
-
} else {
|
|
985
|
-
let m = Util.assertAsMap(request.body);
|
|
986
|
-
let formObj = OpenApiUtil.toForm(m);
|
|
987
|
-
hashedRequestPayload = OpenApiUtil.hexEncode(OpenApiUtil.hash(Util.toBytes(formObj), signatureAlgorithm));
|
|
988
|
-
request_.body = new $tea.BytesReadable(formObj);
|
|
989
|
-
request_.headers["content-type"] = "application/x-www-form-urlencoded";
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
request_.headers["x-acs-content-sha256"] = hashedRequestPayload;
|
|
997
|
-
if (!Util.equalString(params.authType, "Anonymous")) {
|
|
998
|
-
let authType = await this.getType();
|
|
999
|
-
if (Util.equalString(authType, "bearer")) {
|
|
1000
|
-
let bearerToken = await this.getBearerToken();
|
|
1001
|
-
request_.headers["x-acs-bearer-token"] = bearerToken;
|
|
1002
|
-
} else {
|
|
1003
|
-
let accessKeyId = await this.getAccessKeyId();
|
|
1004
|
-
let accessKeySecret = await this.getAccessKeySecret();
|
|
1005
|
-
let securityToken = await this.getSecurityToken();
|
|
1006
|
-
if (!Util.empty(securityToken)) {
|
|
1007
|
-
request_.headers["x-acs-accesskey-id"] = accessKeyId;
|
|
1008
|
-
request_.headers["x-acs-security-token"] = securityToken;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
request_.headers["Authorization"] = OpenApiUtil.getAuthorization(request_, signatureAlgorithm, hashedRequestPayload, accessKeyId, accessKeySecret);
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
_lastRequest = request_;
|
|
1017
|
-
let response_ = await $tea.doAction(request_, _runtime);
|
|
1018
|
-
|
|
1019
|
-
if (Util.is4xx(response_.statusCode) || Util.is5xx(response_.statusCode)) {
|
|
1020
|
-
let err : {[key: string ]: any} = { };
|
|
1021
|
-
if (!Util.isUnset(response_.headers["content-type"]) && Util.equalString(response_.headers["content-type"], "text/xml;charset=utf-8")) {
|
|
1022
|
-
let _str = await Util.readAsString(response_.body);
|
|
1023
|
-
let respMap = XML.parseXml(_str, null);
|
|
1024
|
-
err = Util.assertAsMap(respMap["Error"]);
|
|
1025
|
-
} else {
|
|
1026
|
-
let _res = await Util.readAsJSON(response_.body);
|
|
1027
|
-
err = Util.assertAsMap(_res);
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
err["statusCode"] = response_.statusCode;
|
|
1031
|
-
throw $tea.newError({
|
|
1032
|
-
code: `${Client.defaultAny(err["Code"], err["code"])}`,
|
|
1033
|
-
message: `code: ${response_.statusCode}, ${Client.defaultAny(err["Message"], err["message"])} request id: ${Client.defaultAny(err["RequestId"], err["requestId"])}`,
|
|
1034
|
-
data: err,
|
|
1035
|
-
description: `${Client.defaultAny(err["Description"], err["description"])}`,
|
|
1036
|
-
accessDeniedDetail: Client.defaultAny(err["AccessDeniedDetail"], err["accessDeniedDetail"]),
|
|
1037
|
-
});
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
if (Util.equalString(params.bodyType, "binary")) {
|
|
1041
|
-
let resp = {
|
|
1042
|
-
body: response_.body,
|
|
1043
|
-
headers: response_.headers,
|
|
1044
|
-
statusCode: response_.statusCode,
|
|
1045
|
-
};
|
|
1046
|
-
return resp;
|
|
1047
|
-
} else if (Util.equalString(params.bodyType, "byte")) {
|
|
1048
|
-
let byt = await Util.readAsBytes(response_.body);
|
|
1049
|
-
return {
|
|
1050
|
-
body: byt,
|
|
1051
|
-
headers: response_.headers,
|
|
1052
|
-
statusCode: response_.statusCode,
|
|
1053
|
-
};
|
|
1054
|
-
} else if (Util.equalString(params.bodyType, "string")) {
|
|
1055
|
-
let str = await Util.readAsString(response_.body);
|
|
1056
|
-
return {
|
|
1057
|
-
body: str,
|
|
1058
|
-
headers: response_.headers,
|
|
1059
|
-
statusCode: response_.statusCode,
|
|
1060
|
-
};
|
|
1061
|
-
} else if (Util.equalString(params.bodyType, "json")) {
|
|
1062
|
-
let obj = await Util.readAsJSON(response_.body);
|
|
1063
|
-
let res = Util.assertAsMap(obj);
|
|
1064
|
-
return {
|
|
1065
|
-
body: res,
|
|
1066
|
-
headers: response_.headers,
|
|
1067
|
-
statusCode: response_.statusCode,
|
|
1068
|
-
};
|
|
1069
|
-
} else if (Util.equalString(params.bodyType, "array")) {
|
|
1070
|
-
let arr = await Util.readAsJSON(response_.body);
|
|
1071
|
-
return {
|
|
1072
|
-
body: arr,
|
|
1073
|
-
headers: response_.headers,
|
|
1074
|
-
statusCode: response_.statusCode,
|
|
1075
|
-
};
|
|
1076
|
-
} else {
|
|
1077
|
-
let anything = await Util.readAsString(response_.body);
|
|
1078
|
-
return {
|
|
1079
|
-
body: anything,
|
|
1080
|
-
headers: response_.headers,
|
|
1081
|
-
statusCode: response_.statusCode,
|
|
1082
|
-
};
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
} catch (ex) {
|
|
1086
|
-
if ($tea.isRetryable(ex)) {
|
|
1087
|
-
continue;
|
|
1088
|
-
}
|
|
1089
|
-
throw ex;
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
throw $tea.newUnretryableError(_lastRequest);
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
/**
|
|
1097
|
-
* Encapsulate the request and invoke the network
|
|
1098
|
-
* @param action api name
|
|
1099
|
-
* @param version product version
|
|
1100
|
-
* @param protocol http or https
|
|
1101
|
-
* @param method e.g. GET
|
|
1102
|
-
* @param authType authorization type e.g. AK
|
|
1103
|
-
* @param bodyType response body type e.g. String
|
|
1104
|
-
* @param request object of OpenApiRequest
|
|
1105
|
-
* @param runtime which controls some details of call api, such as retry times
|
|
1106
|
-
* @return the response
|
|
1107
|
-
*/
|
|
1108
|
-
async execute(params: Params, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{[key: string]: any}> {
|
|
1109
|
-
let _runtime: { [key: string]: any } = {
|
|
1110
|
-
timeouted: "retry",
|
|
1111
|
-
key: Util.defaultString(runtime.key, this._key),
|
|
1112
|
-
cert: Util.defaultString(runtime.cert, this._cert),
|
|
1113
|
-
ca: Util.defaultString(runtime.ca, this._ca),
|
|
1114
|
-
readTimeout: Util.defaultNumber(runtime.readTimeout, this._readTimeout),
|
|
1115
|
-
connectTimeout: Util.defaultNumber(runtime.connectTimeout, this._connectTimeout),
|
|
1116
|
-
httpProxy: Util.defaultString(runtime.httpProxy, this._httpProxy),
|
|
1117
|
-
httpsProxy: Util.defaultString(runtime.httpsProxy, this._httpsProxy),
|
|
1118
|
-
noProxy: Util.defaultString(runtime.noProxy, this._noProxy),
|
|
1119
|
-
socks5Proxy: Util.defaultString(runtime.socks5Proxy, this._socks5Proxy),
|
|
1120
|
-
socks5NetWork: Util.defaultString(runtime.socks5NetWork, this._socks5NetWork),
|
|
1121
|
-
maxIdleConns: Util.defaultNumber(runtime.maxIdleConns, this._maxIdleConns),
|
|
1122
|
-
retry: {
|
|
1123
|
-
retryable: runtime.autoretry,
|
|
1124
|
-
maxAttempts: Util.defaultNumber(runtime.maxAttempts, 3),
|
|
1125
|
-
},
|
|
1126
|
-
backoff: {
|
|
1127
|
-
policy: Util.defaultString(runtime.backoffPolicy, "no"),
|
|
1128
|
-
period: Util.defaultNumber(runtime.backoffPeriod, 1),
|
|
1129
|
-
},
|
|
1130
|
-
ignoreSSL: runtime.ignoreSSL,
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
let _lastRequest = null;
|
|
1134
|
-
let _now = Date.now();
|
|
1135
|
-
let _retryTimes = 0;
|
|
1136
|
-
while ($tea.allowRetry(_runtime['retry'], _retryTimes, _now)) {
|
|
1137
|
-
if (_retryTimes > 0) {
|
|
1138
|
-
let _backoffTime = $tea.getBackoffTime(_runtime['backoff'], _retryTimes);
|
|
1139
|
-
if (_backoffTime > 0) {
|
|
1140
|
-
await $tea.sleep(_backoffTime);
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
_retryTimes = _retryTimes + 1;
|
|
1145
|
-
try {
|
|
1146
|
-
let request_ = new $tea.Request();
|
|
1147
|
-
// spi = new Gateway();//Gateway implements SPI,这一步在产品 SDK 中实例化
|
|
1148
|
-
let headers = this.getRpcHeaders();
|
|
1149
|
-
let globalQueries : {[key: string ]: string} = { };
|
|
1150
|
-
let globalHeaders : {[key: string ]: string} = { };
|
|
1151
|
-
if (!Util.isUnset(this._globalParameters)) {
|
|
1152
|
-
let globalParams = this._globalParameters;
|
|
1153
|
-
if (!Util.isUnset(globalParams.queries)) {
|
|
1154
|
-
globalQueries = globalParams.queries;
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
if (!Util.isUnset(globalParams.headers)) {
|
|
1158
|
-
globalHeaders = globalParams.headers;
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
}
|
|
1162
|
-
|
|
1163
|
-
let requestContext = new $SPI.InterceptorContextRequest({
|
|
1164
|
-
headers: {
|
|
1165
|
-
...globalHeaders,
|
|
1166
|
-
...request.headers,
|
|
1167
|
-
...headers,
|
|
1168
|
-
},
|
|
1169
|
-
query: {
|
|
1170
|
-
...globalQueries,
|
|
1171
|
-
...request.query,
|
|
1172
|
-
},
|
|
1173
|
-
body: request.body,
|
|
1174
|
-
stream: request.stream,
|
|
1175
|
-
hostMap: request.hostMap,
|
|
1176
|
-
pathname: params.pathname,
|
|
1177
|
-
productId: this._productId,
|
|
1178
|
-
action: params.action,
|
|
1179
|
-
version: params.version,
|
|
1180
|
-
protocol: Util.defaultString(this._protocol, params.protocol),
|
|
1181
|
-
method: Util.defaultString(this._method, params.method),
|
|
1182
|
-
authType: params.authType,
|
|
1183
|
-
bodyType: params.bodyType,
|
|
1184
|
-
reqBodyType: params.reqBodyType,
|
|
1185
|
-
style: params.style,
|
|
1186
|
-
credential: this._credential,
|
|
1187
|
-
signatureVersion: this._signatureVersion,
|
|
1188
|
-
signatureAlgorithm: this._signatureAlgorithm,
|
|
1189
|
-
userAgent: this.getUserAgent(),
|
|
1190
|
-
});
|
|
1191
|
-
let configurationContext = new $SPI.InterceptorContextConfiguration({
|
|
1192
|
-
regionId: this._regionId,
|
|
1193
|
-
endpoint: Util.defaultString(request.endpointOverride, this._endpoint),
|
|
1194
|
-
endpointRule: this._endpointRule,
|
|
1195
|
-
endpointMap: this._endpointMap,
|
|
1196
|
-
endpointType: this._endpointType,
|
|
1197
|
-
network: this._network,
|
|
1198
|
-
suffix: this._suffix,
|
|
1199
|
-
});
|
|
1200
|
-
let interceptorContext = new $SPI.InterceptorContext({
|
|
1201
|
-
request: requestContext,
|
|
1202
|
-
configuration: configurationContext,
|
|
1203
|
-
});
|
|
1204
|
-
let attributeMap = new $SPI.AttributeMap({ });
|
|
1205
|
-
// 1. spi.modifyConfiguration(context: SPI.InterceptorContext, attributeMap: SPI.AttributeMap);
|
|
1206
|
-
await this._spi.modifyConfiguration(interceptorContext, attributeMap);
|
|
1207
|
-
// 2. spi.modifyRequest(context: SPI.InterceptorContext, attributeMap: SPI.AttributeMap);
|
|
1208
|
-
await this._spi.modifyRequest(interceptorContext, attributeMap);
|
|
1209
|
-
request_.protocol = interceptorContext.request.protocol;
|
|
1210
|
-
request_.method = interceptorContext.request.method;
|
|
1211
|
-
request_.pathname = interceptorContext.request.pathname;
|
|
1212
|
-
request_.query = interceptorContext.request.query;
|
|
1213
|
-
request_.body = interceptorContext.request.stream;
|
|
1214
|
-
request_.headers = interceptorContext.request.headers;
|
|
1215
|
-
_lastRequest = request_;
|
|
1216
|
-
let response_ = await $tea.doAction(request_, _runtime);
|
|
1217
|
-
|
|
1218
|
-
let responseContext = new $SPI.InterceptorContextResponse({
|
|
1219
|
-
statusCode: response_.statusCode,
|
|
1220
|
-
headers: response_.headers,
|
|
1221
|
-
body: response_.body,
|
|
1222
|
-
});
|
|
1223
|
-
interceptorContext.response = responseContext;
|
|
1224
|
-
// 3. spi.modifyResponse(context: SPI.InterceptorContext, attributeMap: SPI.AttributeMap);
|
|
1225
|
-
await this._spi.modifyResponse(interceptorContext, attributeMap);
|
|
1226
|
-
return {
|
|
1227
|
-
headers: interceptorContext.response.headers,
|
|
1228
|
-
statusCode: interceptorContext.response.statusCode,
|
|
1229
|
-
body: interceptorContext.response.deserializedBody,
|
|
1230
|
-
};
|
|
1231
|
-
} catch (ex) {
|
|
1232
|
-
if ($tea.isRetryable(ex)) {
|
|
1233
|
-
continue;
|
|
1234
|
-
}
|
|
1235
|
-
throw ex;
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
throw $tea.newUnretryableError(_lastRequest);
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
async callApi(params: Params, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{[key: string]: any}> {
|
|
1243
|
-
if (Util.isUnset(params)) {
|
|
1244
|
-
throw $tea.newError({
|
|
1245
|
-
code: "ParameterMissing",
|
|
1246
|
-
message: "'params' can not be unset",
|
|
1247
|
-
});
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
if (Util.isUnset(this._signatureAlgorithm) || !Util.equalString(this._signatureAlgorithm, "v2")) {
|
|
1251
|
-
return await this.doRequest(params, request, runtime);
|
|
1252
|
-
} else if (Util.equalString(params.style, "ROA") && Util.equalString(params.reqBodyType, "json")) {
|
|
1253
|
-
return await this.doROARequest(params.action, params.version, params.protocol, params.method, params.authType, params.pathname, params.bodyType, request, runtime);
|
|
1254
|
-
} else if (Util.equalString(params.style, "ROA")) {
|
|
1255
|
-
return await this.doROARequestWithForm(params.action, params.version, params.protocol, params.method, params.authType, params.pathname, params.bodyType, request, runtime);
|
|
1256
|
-
} else {
|
|
1257
|
-
return await this.doRPCRequest(params.action, params.version, params.protocol, params.method, params.authType, params.bodyType, request, runtime);
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
/**
|
|
1263
|
-
* Get user agent
|
|
1264
|
-
* @return user agent
|
|
1265
|
-
*/
|
|
1266
|
-
getUserAgent(): string {
|
|
1267
|
-
let userAgent = Util.getUserAgent(this._userAgent);
|
|
1268
|
-
return userAgent;
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
/**
|
|
1272
|
-
* Get accesskey id by using credential
|
|
1273
|
-
* @return accesskey id
|
|
1274
|
-
*/
|
|
1275
|
-
async getAccessKeyId(): Promise<string> {
|
|
1276
|
-
if (Util.isUnset(this._credential)) {
|
|
1277
|
-
return "";
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
let accessKeyId = await this._credential.getAccessKeyId();
|
|
1281
|
-
return accessKeyId;
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
/**
|
|
1285
|
-
* Get accesskey secret by using credential
|
|
1286
|
-
* @return accesskey secret
|
|
1287
|
-
*/
|
|
1288
|
-
async getAccessKeySecret(): Promise<string> {
|
|
1289
|
-
if (Util.isUnset(this._credential)) {
|
|
1290
|
-
return "";
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
let secret = await this._credential.getAccessKeySecret();
|
|
1294
|
-
return secret;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
/**
|
|
1298
|
-
* Get security token by using credential
|
|
1299
|
-
* @return security token
|
|
1300
|
-
*/
|
|
1301
|
-
async getSecurityToken(): Promise<string> {
|
|
1302
|
-
if (Util.isUnset(this._credential)) {
|
|
1303
|
-
return "";
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
let token = await this._credential.getSecurityToken();
|
|
1307
|
-
return token;
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
/**
|
|
1311
|
-
* Get bearer token by credential
|
|
1312
|
-
* @return bearer token
|
|
1313
|
-
*/
|
|
1314
|
-
async getBearerToken(): Promise<string> {
|
|
1315
|
-
if (Util.isUnset(this._credential)) {
|
|
1316
|
-
return "";
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
let token = this._credential.getBearerToken();
|
|
1320
|
-
return token;
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
/**
|
|
1324
|
-
* Get credential type by credential
|
|
1325
|
-
* @return credential type e.g. access_key
|
|
1326
|
-
*/
|
|
1327
|
-
async getType(): Promise<string> {
|
|
1328
|
-
if (Util.isUnset(this._credential)) {
|
|
1329
|
-
return "";
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
let authType = this._credential.getType();
|
|
1333
|
-
return authType;
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
/**
|
|
1337
|
-
* If inputValue is not null, return it or return defaultValue
|
|
1338
|
-
* @param inputValue users input value
|
|
1339
|
-
* @param defaultValue default value
|
|
1340
|
-
* @return the final result
|
|
1341
|
-
*/
|
|
1342
|
-
static defaultAny(inputValue: any, defaultValue: any): any {
|
|
1343
|
-
if (Util.isUnset(inputValue)) {
|
|
1344
|
-
return defaultValue;
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
return inputValue;
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
/**
|
|
1351
|
-
* If the endpointRule and config.endpoint are empty, throw error
|
|
1352
|
-
* @param config config contains the necessary information to create a client
|
|
1353
|
-
*/
|
|
1354
|
-
checkConfig(config: Config): void {
|
|
1355
|
-
if (Util.empty(this._endpointRule) && Util.empty(config.endpoint)) {
|
|
1356
|
-
throw $tea.newError({
|
|
1357
|
-
code: "ParameterMissing",
|
|
1358
|
-
message: "'config.endpoint' can not be empty",
|
|
1359
|
-
});
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
/**
|
|
1365
|
-
* set gateway client
|
|
1366
|
-
* @param spi.
|
|
1367
|
-
*/
|
|
1368
|
-
setGatewayClient(spi: SPI): void {
|
|
1369
|
-
this._spi = spi;
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
|
-
/**
|
|
1373
|
-
* set RPC header for debug
|
|
1374
|
-
* @param headers headers for debug, this header can be used only once.
|
|
1375
|
-
*/
|
|
1376
|
-
setRpcHeaders(headers: {[key: string ]: string}): void {
|
|
1377
|
-
this._headers = headers;
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
/**
|
|
1381
|
-
* get RPC header for debug
|
|
1382
|
-
*/
|
|
1383
|
-
getRpcHeaders(): {[key: string ]: string} {
|
|
1384
|
-
let headers : {[key: string ]: string} = this._headers;
|
|
1385
|
-
this._headers = null;
|
|
1386
|
-
return headers;
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
}
|