@tachybase/plugin-auth-dingtalk 1.3.17 → 1.3.18
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 +5 -5
- package/dist/node_modules/@alicloud/dingtalk/dist/index.js +2 -2
- package/dist/node_modules/@alicloud/dingtalk/package.json +1 -1
- package/dist/node_modules/@alicloud/openapi-client/dist/client.d.ts +299 -62
- package/dist/node_modules/@alicloud/openapi-client/dist/client.js +2 -2
- package/dist/node_modules/@alicloud/openapi-client/package.json +1 -1
- package/dist/node_modules/@alicloud/openapi-client/src/client.ts +383 -71
- package/dist/node_modules/@alicloud/tea-util/dist/client.js +1 -1
- package/dist/node_modules/@alicloud/tea-util/package.json +1 -1
- package/package.json +8 -8
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// This file is auto-generated, don't edit it
|
|
2
2
|
/**
|
|
3
|
+
* @remarks
|
|
3
4
|
* This is for OpenApi SDK
|
|
4
5
|
*/
|
|
5
6
|
import Util, * as $Util from '@alicloud/tea-util';
|
|
@@ -33,39 +34,247 @@ export class GlobalParameters extends $tea.Model {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
/**
|
|
37
|
+
* @remarks
|
|
36
38
|
* Model for initing client
|
|
37
39
|
*/
|
|
38
40
|
export class Config extends $tea.Model {
|
|
41
|
+
/**
|
|
42
|
+
* @remarks
|
|
43
|
+
* accesskey id
|
|
44
|
+
*/
|
|
39
45
|
accessKeyId?: string;
|
|
46
|
+
/**
|
|
47
|
+
* @remarks
|
|
48
|
+
* accesskey secret
|
|
49
|
+
*/
|
|
40
50
|
accessKeySecret?: string;
|
|
51
|
+
/**
|
|
52
|
+
* @remarks
|
|
53
|
+
* security token
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* a.txt
|
|
57
|
+
*/
|
|
41
58
|
securityToken?: string;
|
|
59
|
+
/**
|
|
60
|
+
* @remarks
|
|
61
|
+
* bearer token
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* the-bearer-token
|
|
65
|
+
*/
|
|
42
66
|
bearerToken?: string;
|
|
67
|
+
/**
|
|
68
|
+
* @remarks
|
|
69
|
+
* http protocol
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* http
|
|
73
|
+
*/
|
|
43
74
|
protocol?: string;
|
|
75
|
+
/**
|
|
76
|
+
* @remarks
|
|
77
|
+
* http method
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* GET
|
|
81
|
+
*/
|
|
44
82
|
method?: string;
|
|
83
|
+
/**
|
|
84
|
+
* @remarks
|
|
85
|
+
* region id
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* cn-hangzhou
|
|
89
|
+
*/
|
|
45
90
|
regionId?: string;
|
|
91
|
+
/**
|
|
92
|
+
* @remarks
|
|
93
|
+
* read timeout
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* 10
|
|
97
|
+
*/
|
|
46
98
|
readTimeout?: number;
|
|
99
|
+
/**
|
|
100
|
+
* @remarks
|
|
101
|
+
* connect timeout
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* 10
|
|
105
|
+
*/
|
|
47
106
|
connectTimeout?: number;
|
|
107
|
+
/**
|
|
108
|
+
* @remarks
|
|
109
|
+
* http proxy
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* http://localhost
|
|
113
|
+
*/
|
|
48
114
|
httpProxy?: string;
|
|
115
|
+
/**
|
|
116
|
+
* @remarks
|
|
117
|
+
* https proxy
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* https://localhost
|
|
121
|
+
*/
|
|
49
122
|
httpsProxy?: string;
|
|
123
|
+
/**
|
|
124
|
+
* @remarks
|
|
125
|
+
* credential
|
|
126
|
+
*/
|
|
50
127
|
credential?: Credential;
|
|
128
|
+
/**
|
|
129
|
+
* @remarks
|
|
130
|
+
* endpoint
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* cs.aliyuncs.com
|
|
134
|
+
*/
|
|
51
135
|
endpoint?: string;
|
|
136
|
+
/**
|
|
137
|
+
* @remarks
|
|
138
|
+
* proxy white list
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* http://localhost
|
|
142
|
+
*/
|
|
52
143
|
noProxy?: string;
|
|
144
|
+
/**
|
|
145
|
+
* @remarks
|
|
146
|
+
* max idle conns
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* 3
|
|
150
|
+
*/
|
|
53
151
|
maxIdleConns?: number;
|
|
152
|
+
/**
|
|
153
|
+
* @remarks
|
|
154
|
+
* network for endpoint
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* public
|
|
158
|
+
*/
|
|
54
159
|
network?: string;
|
|
160
|
+
/**
|
|
161
|
+
* @remarks
|
|
162
|
+
* user agent
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* Alibabacloud/1
|
|
166
|
+
*/
|
|
55
167
|
userAgent?: string;
|
|
168
|
+
/**
|
|
169
|
+
* @remarks
|
|
170
|
+
* suffix for endpoint
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* aliyun
|
|
174
|
+
*/
|
|
56
175
|
suffix?: string;
|
|
176
|
+
/**
|
|
177
|
+
* @remarks
|
|
178
|
+
* socks5 proxy
|
|
179
|
+
*/
|
|
57
180
|
socks5Proxy?: string;
|
|
181
|
+
/**
|
|
182
|
+
* @remarks
|
|
183
|
+
* socks5 network
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* TCP
|
|
187
|
+
*/
|
|
58
188
|
socks5NetWork?: string;
|
|
189
|
+
/**
|
|
190
|
+
* @remarks
|
|
191
|
+
* endpoint type
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* internal
|
|
195
|
+
*/
|
|
59
196
|
endpointType?: string;
|
|
197
|
+
/**
|
|
198
|
+
* @remarks
|
|
199
|
+
* OpenPlatform endpoint
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* openplatform.aliyuncs.com
|
|
203
|
+
*/
|
|
60
204
|
openPlatformEndpoint?: string;
|
|
205
|
+
/**
|
|
206
|
+
* @remarks
|
|
207
|
+
* credential type
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* access_key
|
|
211
|
+
*
|
|
212
|
+
* @deprecated
|
|
213
|
+
*/
|
|
61
214
|
type?: string;
|
|
215
|
+
/**
|
|
216
|
+
* @remarks
|
|
217
|
+
* Signature Version
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* v1
|
|
221
|
+
*/
|
|
62
222
|
signatureVersion?: string;
|
|
223
|
+
/**
|
|
224
|
+
* @remarks
|
|
225
|
+
* Signature Algorithm
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ACS3-HMAC-SHA256
|
|
229
|
+
*/
|
|
63
230
|
signatureAlgorithm?: string;
|
|
231
|
+
/**
|
|
232
|
+
* @remarks
|
|
233
|
+
* Global Parameters
|
|
234
|
+
*/
|
|
64
235
|
globalParameters?: GlobalParameters;
|
|
236
|
+
/**
|
|
237
|
+
* @remarks
|
|
238
|
+
* privite key for client certificate
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* MIIEvQ
|
|
242
|
+
*/
|
|
65
243
|
key?: string;
|
|
244
|
+
/**
|
|
245
|
+
* @remarks
|
|
246
|
+
* client certificate
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* -----BEGIN CERTIFICATE-----
|
|
250
|
+
* xxx-----END CERTIFICATE-----
|
|
251
|
+
*/
|
|
66
252
|
cert?: string;
|
|
253
|
+
/**
|
|
254
|
+
* @remarks
|
|
255
|
+
* server certificate
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* -----BEGIN CERTIFICATE-----
|
|
259
|
+
* xxx-----END CERTIFICATE-----
|
|
260
|
+
*/
|
|
67
261
|
ca?: string;
|
|
262
|
+
/**
|
|
263
|
+
* @remarks
|
|
264
|
+
* disable HTTP/2
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* false
|
|
268
|
+
*/
|
|
68
269
|
disableHttp2?: boolean;
|
|
270
|
+
/**
|
|
271
|
+
* @remarks
|
|
272
|
+
* TLS Minimum Version
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* TLSv1, TLSv1.1, TLSv1.2, TLSv1.3
|
|
276
|
+
*/
|
|
277
|
+
tlsMinVersion?: string;
|
|
69
278
|
static names(): { [key: string]: string } {
|
|
70
279
|
return {
|
|
71
280
|
accessKeyId: 'accessKeyId',
|
|
@@ -98,6 +307,7 @@ export class Config extends $tea.Model {
|
|
|
98
307
|
cert: 'cert',
|
|
99
308
|
ca: 'ca',
|
|
100
309
|
disableHttp2: 'disableHttp2',
|
|
310
|
+
tlsMinVersion: 'tlsMinVersion',
|
|
101
311
|
};
|
|
102
312
|
}
|
|
103
313
|
|
|
@@ -133,6 +343,7 @@ export class Config extends $tea.Model {
|
|
|
133
343
|
cert: 'string',
|
|
134
344
|
ca: 'string',
|
|
135
345
|
disableHttp2: 'boolean',
|
|
346
|
+
tlsMinVersion: 'string',
|
|
136
347
|
};
|
|
137
348
|
}
|
|
138
349
|
|
|
@@ -250,10 +461,14 @@ export default class Client {
|
|
|
250
461
|
_cert: string;
|
|
251
462
|
_ca: string;
|
|
252
463
|
_disableHttp2: boolean;
|
|
464
|
+
_tlsMinVersion: string;
|
|
465
|
+
_attributeMap: $SPI.AttributeMap;
|
|
253
466
|
|
|
254
467
|
/**
|
|
468
|
+
* @remarks
|
|
255
469
|
* Init client with Config
|
|
256
|
-
*
|
|
470
|
+
*
|
|
471
|
+
* @param config - config contains the necessary information to create a client
|
|
257
472
|
*/
|
|
258
473
|
constructor(config: Config) {
|
|
259
474
|
if (Util.isUnset(config)) {
|
|
@@ -310,19 +525,22 @@ export default class Client {
|
|
|
310
525
|
this._cert = config.cert;
|
|
311
526
|
this._ca = config.ca;
|
|
312
527
|
this._disableHttp2 = config.disableHttp2;
|
|
528
|
+
this._tlsMinVersion = config.tlsMinVersion;
|
|
313
529
|
}
|
|
314
530
|
|
|
315
531
|
/**
|
|
532
|
+
* @remarks
|
|
316
533
|
* Encapsulate the request and invoke the network
|
|
317
|
-
*
|
|
318
|
-
* @param
|
|
319
|
-
* @param
|
|
320
|
-
* @param
|
|
321
|
-
* @param
|
|
322
|
-
* @param
|
|
323
|
-
* @param
|
|
324
|
-
* @param
|
|
325
|
-
* @
|
|
534
|
+
*
|
|
535
|
+
* @param action - api name
|
|
536
|
+
* @param version - product version
|
|
537
|
+
* @param protocol - http or https
|
|
538
|
+
* @param method - e.g. GET
|
|
539
|
+
* @param authType - authorization type e.g. AK
|
|
540
|
+
* @param bodyType - response body type e.g. String
|
|
541
|
+
* @param request - object of OpenApiRequest
|
|
542
|
+
* @param runtime - which controls some details of call api, such as retry times
|
|
543
|
+
* @returns the response
|
|
326
544
|
*/
|
|
327
545
|
async doRPCRequest(action: string, version: string, protocol: string, method: string, authType: string, bodyType: string, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{[key: string]: any}> {
|
|
328
546
|
let _runtime: { [key: string]: any } = {
|
|
@@ -347,6 +565,7 @@ export default class Client {
|
|
|
347
565
|
period: Util.defaultNumber(runtime.backoffPeriod, 1),
|
|
348
566
|
},
|
|
349
567
|
ignoreSSL: runtime.ignoreSSL,
|
|
568
|
+
tlsMinVersion: this._tlsMinVersion,
|
|
350
569
|
}
|
|
351
570
|
|
|
352
571
|
let _lastRequest = null;
|
|
@@ -414,6 +633,7 @@ export default class Client {
|
|
|
414
633
|
'user-agent': this.getUserAgent(),
|
|
415
634
|
...globalHeaders,
|
|
416
635
|
...extendsHeaders,
|
|
636
|
+
...request.headers,
|
|
417
637
|
};
|
|
418
638
|
} else {
|
|
419
639
|
request_.headers = {
|
|
@@ -423,6 +643,7 @@ export default class Client {
|
|
|
423
643
|
'user-agent': this.getUserAgent(),
|
|
424
644
|
...globalHeaders,
|
|
425
645
|
...extendsHeaders,
|
|
646
|
+
...request.headers,
|
|
426
647
|
...headers,
|
|
427
648
|
};
|
|
428
649
|
}
|
|
@@ -435,12 +656,26 @@ export default class Client {
|
|
|
435
656
|
}
|
|
436
657
|
|
|
437
658
|
if (!Util.equalString(authType, "Anonymous")) {
|
|
659
|
+
if (Util.isUnset(this._credential)) {
|
|
660
|
+
throw $tea.newError({
|
|
661
|
+
code: `InvalidCredentials`,
|
|
662
|
+
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.`,
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
|
|
438
666
|
let credentialModel = await this._credential.getCredential();
|
|
667
|
+
if (!Util.empty(credentialModel.providerName)) {
|
|
668
|
+
request_.headers["x-acs-credentials-provider"] = credentialModel.providerName;
|
|
669
|
+
}
|
|
670
|
+
|
|
439
671
|
let credentialType = credentialModel.type;
|
|
440
672
|
if (Util.equalString(credentialType, "bearer")) {
|
|
441
673
|
let bearerToken = credentialModel.bearerToken;
|
|
442
674
|
request_.query["BearerToken"] = bearerToken;
|
|
443
675
|
request_.query["SignatureType"] = "BEARERTOKEN";
|
|
676
|
+
} else if (Util.equalString(credentialType, "id_token")) {
|
|
677
|
+
let idToken = credentialModel.securityToken;
|
|
678
|
+
request_.headers["x-acs-zero-trust-idtoken"] = idToken;
|
|
444
679
|
} else {
|
|
445
680
|
let accessKeyId = credentialModel.accessKeyId;
|
|
446
681
|
let accessKeySecret = credentialModel.accessKeySecret;
|
|
@@ -538,17 +773,19 @@ export default class Client {
|
|
|
538
773
|
}
|
|
539
774
|
|
|
540
775
|
/**
|
|
776
|
+
* @remarks
|
|
541
777
|
* Encapsulate the request and invoke the network
|
|
542
|
-
*
|
|
543
|
-
* @param
|
|
544
|
-
* @param
|
|
545
|
-
* @param
|
|
546
|
-
* @param
|
|
547
|
-
* @param
|
|
548
|
-
* @param
|
|
549
|
-
* @param
|
|
550
|
-
* @param
|
|
551
|
-
* @
|
|
778
|
+
*
|
|
779
|
+
* @param action - api name
|
|
780
|
+
* @param version - product version
|
|
781
|
+
* @param protocol - http or https
|
|
782
|
+
* @param method - e.g. GET
|
|
783
|
+
* @param authType - authorization type e.g. AK
|
|
784
|
+
* @param pathname - pathname of every api
|
|
785
|
+
* @param bodyType - response body type e.g. String
|
|
786
|
+
* @param request - object of OpenApiRequest
|
|
787
|
+
* @param runtime - which controls some details of call api, such as retry times
|
|
788
|
+
* @returns the response
|
|
552
789
|
*/
|
|
553
790
|
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}> {
|
|
554
791
|
let _runtime: { [key: string]: any } = {
|
|
@@ -573,6 +810,7 @@ export default class Client {
|
|
|
573
810
|
period: Util.defaultNumber(runtime.backoffPeriod, 1),
|
|
574
811
|
},
|
|
575
812
|
ignoreSSL: runtime.ignoreSSL,
|
|
813
|
+
tlsMinVersion: this._tlsMinVersion,
|
|
576
814
|
}
|
|
577
815
|
|
|
578
816
|
let _lastRequest = null;
|
|
@@ -651,12 +889,26 @@ export default class Client {
|
|
|
651
889
|
}
|
|
652
890
|
|
|
653
891
|
if (!Util.equalString(authType, "Anonymous")) {
|
|
892
|
+
if (Util.isUnset(this._credential)) {
|
|
893
|
+
throw $tea.newError({
|
|
894
|
+
code: `InvalidCredentials`,
|
|
895
|
+
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.`,
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
|
|
654
899
|
let credentialModel = await this._credential.getCredential();
|
|
900
|
+
if (!Util.empty(credentialModel.providerName)) {
|
|
901
|
+
request_.headers["x-acs-credentials-provider"] = credentialModel.providerName;
|
|
902
|
+
}
|
|
903
|
+
|
|
655
904
|
let credentialType = credentialModel.type;
|
|
656
905
|
if (Util.equalString(credentialType, "bearer")) {
|
|
657
906
|
let bearerToken = credentialModel.bearerToken;
|
|
658
907
|
request_.headers["x-acs-bearer-token"] = bearerToken;
|
|
659
908
|
request_.headers["x-acs-signature-type"] = "BEARERTOKEN";
|
|
909
|
+
} else if (Util.equalString(credentialType, "id_token")) {
|
|
910
|
+
let idToken = credentialModel.securityToken;
|
|
911
|
+
request_.headers["x-acs-zero-trust-idtoken"] = idToken;
|
|
660
912
|
} else {
|
|
661
913
|
let accessKeyId = credentialModel.accessKeyId;
|
|
662
914
|
let accessKeySecret = credentialModel.accessKeySecret;
|
|
@@ -751,17 +1003,19 @@ export default class Client {
|
|
|
751
1003
|
}
|
|
752
1004
|
|
|
753
1005
|
/**
|
|
1006
|
+
* @remarks
|
|
754
1007
|
* Encapsulate the request and invoke the network with form body
|
|
755
|
-
*
|
|
756
|
-
* @param
|
|
757
|
-
* @param
|
|
758
|
-
* @param
|
|
759
|
-
* @param
|
|
760
|
-
* @param
|
|
761
|
-
* @param
|
|
762
|
-
* @param
|
|
763
|
-
* @param
|
|
764
|
-
* @
|
|
1008
|
+
*
|
|
1009
|
+
* @param action - api name
|
|
1010
|
+
* @param version - product version
|
|
1011
|
+
* @param protocol - http or https
|
|
1012
|
+
* @param method - e.g. GET
|
|
1013
|
+
* @param authType - authorization type e.g. AK
|
|
1014
|
+
* @param pathname - pathname of every api
|
|
1015
|
+
* @param bodyType - response body type e.g. String
|
|
1016
|
+
* @param request - object of OpenApiRequest
|
|
1017
|
+
* @param runtime - which controls some details of call api, such as retry times
|
|
1018
|
+
* @returns the response
|
|
765
1019
|
*/
|
|
766
1020
|
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}> {
|
|
767
1021
|
let _runtime: { [key: string]: any } = {
|
|
@@ -786,6 +1040,7 @@ export default class Client {
|
|
|
786
1040
|
period: Util.defaultNumber(runtime.backoffPeriod, 1),
|
|
787
1041
|
},
|
|
788
1042
|
ignoreSSL: runtime.ignoreSSL,
|
|
1043
|
+
tlsMinVersion: this._tlsMinVersion,
|
|
789
1044
|
}
|
|
790
1045
|
|
|
791
1046
|
let _lastRequest = null;
|
|
@@ -865,12 +1120,26 @@ export default class Client {
|
|
|
865
1120
|
}
|
|
866
1121
|
|
|
867
1122
|
if (!Util.equalString(authType, "Anonymous")) {
|
|
1123
|
+
if (Util.isUnset(this._credential)) {
|
|
1124
|
+
throw $tea.newError({
|
|
1125
|
+
code: `InvalidCredentials`,
|
|
1126
|
+
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.`,
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
|
|
868
1130
|
let credentialModel = await this._credential.getCredential();
|
|
1131
|
+
if (!Util.empty(credentialModel.providerName)) {
|
|
1132
|
+
request_.headers["x-acs-credentials-provider"] = credentialModel.providerName;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
869
1135
|
let credentialType = credentialModel.type;
|
|
870
1136
|
if (Util.equalString(credentialType, "bearer")) {
|
|
871
1137
|
let bearerToken = credentialModel.bearerToken;
|
|
872
1138
|
request_.headers["x-acs-bearer-token"] = bearerToken;
|
|
873
1139
|
request_.headers["x-acs-signature-type"] = "BEARERTOKEN";
|
|
1140
|
+
} else if (Util.equalString(credentialType, "id_token")) {
|
|
1141
|
+
let idToken = credentialModel.securityToken;
|
|
1142
|
+
request_.headers["x-acs-zero-trust-idtoken"] = idToken;
|
|
874
1143
|
} else {
|
|
875
1144
|
let accessKeyId = credentialModel.accessKeyId;
|
|
876
1145
|
let accessKeySecret = credentialModel.accessKeySecret;
|
|
@@ -963,16 +1232,18 @@ export default class Client {
|
|
|
963
1232
|
}
|
|
964
1233
|
|
|
965
1234
|
/**
|
|
1235
|
+
* @remarks
|
|
966
1236
|
* Encapsulate the request and invoke the network
|
|
967
|
-
*
|
|
968
|
-
* @param
|
|
969
|
-
* @param
|
|
970
|
-
* @param
|
|
971
|
-
* @param
|
|
972
|
-
* @param
|
|
973
|
-
* @param
|
|
974
|
-
* @param
|
|
975
|
-
* @
|
|
1237
|
+
*
|
|
1238
|
+
* @param action - api name
|
|
1239
|
+
* @param version - product version
|
|
1240
|
+
* @param protocol - http or https
|
|
1241
|
+
* @param method - e.g. GET
|
|
1242
|
+
* @param authType - authorization type e.g. AK
|
|
1243
|
+
* @param bodyType - response body type e.g. String
|
|
1244
|
+
* @param request - object of OpenApiRequest
|
|
1245
|
+
* @param runtime - which controls some details of call api, such as retry times
|
|
1246
|
+
* @returns the response
|
|
976
1247
|
*/
|
|
977
1248
|
async doRequest(params: Params, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{[key: string]: any}> {
|
|
978
1249
|
let _runtime: { [key: string]: any } = {
|
|
@@ -997,6 +1268,7 @@ export default class Client {
|
|
|
997
1268
|
period: Util.defaultNumber(runtime.backoffPeriod, 1),
|
|
998
1269
|
},
|
|
999
1270
|
ignoreSSL: runtime.ignoreSSL,
|
|
1271
|
+
tlsMinVersion: this._tlsMinVersion,
|
|
1000
1272
|
}
|
|
1001
1273
|
|
|
1002
1274
|
let _lastRequest = null;
|
|
@@ -1105,7 +1377,18 @@ export default class Client {
|
|
|
1105
1377
|
|
|
1106
1378
|
request_.headers["x-acs-content-sha256"] = hashedRequestPayload;
|
|
1107
1379
|
if (!Util.equalString(params.authType, "Anonymous")) {
|
|
1380
|
+
if (Util.isUnset(this._credential)) {
|
|
1381
|
+
throw $tea.newError({
|
|
1382
|
+
code: `InvalidCredentials`,
|
|
1383
|
+
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.`,
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1108
1387
|
let credentialModel = await this._credential.getCredential();
|
|
1388
|
+
if (!Util.empty(credentialModel.providerName)) {
|
|
1389
|
+
request_.headers["x-acs-credentials-provider"] = credentialModel.providerName;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1109
1392
|
let authType = credentialModel.type;
|
|
1110
1393
|
if (Util.equalString(authType, "bearer")) {
|
|
1111
1394
|
let bearerToken = credentialModel.bearerToken;
|
|
@@ -1116,6 +1399,9 @@ export default class Client {
|
|
|
1116
1399
|
request_.headers["x-acs-signature-type"] = "BEARERTOKEN";
|
|
1117
1400
|
}
|
|
1118
1401
|
|
|
1402
|
+
} else if (Util.equalString(authType, "id_token")) {
|
|
1403
|
+
let idToken = credentialModel.securityToken;
|
|
1404
|
+
request_.headers["x-acs-zero-trust-idtoken"] = idToken;
|
|
1119
1405
|
} else {
|
|
1120
1406
|
let accessKeyId = credentialModel.accessKeyId;
|
|
1121
1407
|
let accessKeySecret = credentialModel.accessKeySecret;
|
|
@@ -1211,16 +1497,18 @@ export default class Client {
|
|
|
1211
1497
|
}
|
|
1212
1498
|
|
|
1213
1499
|
/**
|
|
1500
|
+
* @remarks
|
|
1214
1501
|
* Encapsulate the request and invoke the network
|
|
1215
|
-
*
|
|
1216
|
-
* @param
|
|
1217
|
-
* @param
|
|
1218
|
-
* @param
|
|
1219
|
-
* @param
|
|
1220
|
-
* @param
|
|
1221
|
-
* @param
|
|
1222
|
-
* @param
|
|
1223
|
-
* @
|
|
1502
|
+
*
|
|
1503
|
+
* @param action - api name
|
|
1504
|
+
* @param version - product version
|
|
1505
|
+
* @param protocol - http or https
|
|
1506
|
+
* @param method - e.g. GET
|
|
1507
|
+
* @param authType - authorization type e.g. AK
|
|
1508
|
+
* @param bodyType - response body type e.g. String
|
|
1509
|
+
* @param request - object of OpenApiRequest
|
|
1510
|
+
* @param runtime - which controls some details of call api, such as retry times
|
|
1511
|
+
* @returns the response
|
|
1224
1512
|
*/
|
|
1225
1513
|
async execute(params: Params, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{[key: string]: any}> {
|
|
1226
1514
|
let _runtime: { [key: string]: any } = {
|
|
@@ -1246,6 +1534,7 @@ export default class Client {
|
|
|
1246
1534
|
},
|
|
1247
1535
|
ignoreSSL: runtime.ignoreSSL,
|
|
1248
1536
|
disableHttp2: Client.defaultAny(this._disableHttp2, false),
|
|
1537
|
+
tlsMinVersion: this._tlsMinVersion,
|
|
1249
1538
|
}
|
|
1250
1539
|
|
|
1251
1540
|
let _lastRequest = null;
|
|
@@ -1331,11 +1620,14 @@ export default class Client {
|
|
|
1331
1620
|
network: this._network,
|
|
1332
1621
|
suffix: this._suffix,
|
|
1333
1622
|
});
|
|
1334
|
-
let interceptorContext = new $SPI.InterceptorContext({
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
});
|
|
1623
|
+
let interceptorContext = new $SPI.InterceptorContext({ });
|
|
1624
|
+
interceptorContext.request = requestContext;
|
|
1625
|
+
interceptorContext.configuration = configurationContext;
|
|
1338
1626
|
let attributeMap = new $SPI.AttributeMap({ });
|
|
1627
|
+
if (!Util.isUnset(this._attributeMap)) {
|
|
1628
|
+
attributeMap = this._attributeMap;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1339
1631
|
// 1. spi.modifyConfiguration(context: SPI.InterceptorContext, attributeMap: SPI.AttributeMap);
|
|
1340
1632
|
await this._spi.modifyConfiguration(interceptorContext, attributeMap);
|
|
1341
1633
|
// 2. spi.modifyRequest(context: SPI.InterceptorContext, attributeMap: SPI.AttributeMap);
|
|
@@ -1381,21 +1673,27 @@ export default class Client {
|
|
|
1381
1673
|
});
|
|
1382
1674
|
}
|
|
1383
1675
|
|
|
1384
|
-
if (Util.isUnset(this.
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1676
|
+
if (Util.isUnset(this._signatureVersion) || !Util.equalString(this._signatureVersion, "v4")) {
|
|
1677
|
+
if (Util.isUnset(this._signatureAlgorithm) || !Util.equalString(this._signatureAlgorithm, "v2")) {
|
|
1678
|
+
return await this.doRequest(params, request, runtime);
|
|
1679
|
+
} else if (Util.equalString(params.style, "ROA") && Util.equalString(params.reqBodyType, "json")) {
|
|
1680
|
+
return await this.doROARequest(params.action, params.version, params.protocol, params.method, params.authType, params.pathname, params.bodyType, request, runtime);
|
|
1681
|
+
} else if (Util.equalString(params.style, "ROA")) {
|
|
1682
|
+
return await this.doROARequestWithForm(params.action, params.version, params.protocol, params.method, params.authType, params.pathname, params.bodyType, request, runtime);
|
|
1683
|
+
} else {
|
|
1684
|
+
return await this.doRPCRequest(params.action, params.version, params.protocol, params.method, params.authType, params.bodyType, request, runtime);
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1390
1687
|
} else {
|
|
1391
|
-
return await this.
|
|
1688
|
+
return await this.execute(params, request, runtime);
|
|
1392
1689
|
}
|
|
1393
1690
|
|
|
1394
1691
|
}
|
|
1395
1692
|
|
|
1396
1693
|
/**
|
|
1694
|
+
* @remarks
|
|
1397
1695
|
* Get user agent
|
|
1398
|
-
* @
|
|
1696
|
+
* @returns user agent
|
|
1399
1697
|
*/
|
|
1400
1698
|
getUserAgent(): string {
|
|
1401
1699
|
let userAgent = Util.getUserAgent(this._userAgent);
|
|
@@ -1403,8 +1701,9 @@ export default class Client {
|
|
|
1403
1701
|
}
|
|
1404
1702
|
|
|
1405
1703
|
/**
|
|
1704
|
+
* @remarks
|
|
1406
1705
|
* Get accesskey id by using credential
|
|
1407
|
-
* @
|
|
1706
|
+
* @returns accesskey id
|
|
1408
1707
|
*/
|
|
1409
1708
|
async getAccessKeyId(): Promise<string> {
|
|
1410
1709
|
if (Util.isUnset(this._credential)) {
|
|
@@ -1416,8 +1715,9 @@ export default class Client {
|
|
|
1416
1715
|
}
|
|
1417
1716
|
|
|
1418
1717
|
/**
|
|
1718
|
+
* @remarks
|
|
1419
1719
|
* Get accesskey secret by using credential
|
|
1420
|
-
* @
|
|
1720
|
+
* @returns accesskey secret
|
|
1421
1721
|
*/
|
|
1422
1722
|
async getAccessKeySecret(): Promise<string> {
|
|
1423
1723
|
if (Util.isUnset(this._credential)) {
|
|
@@ -1429,8 +1729,9 @@ export default class Client {
|
|
|
1429
1729
|
}
|
|
1430
1730
|
|
|
1431
1731
|
/**
|
|
1732
|
+
* @remarks
|
|
1432
1733
|
* Get security token by using credential
|
|
1433
|
-
* @
|
|
1734
|
+
* @returns security token
|
|
1434
1735
|
*/
|
|
1435
1736
|
async getSecurityToken(): Promise<string> {
|
|
1436
1737
|
if (Util.isUnset(this._credential)) {
|
|
@@ -1442,8 +1743,9 @@ export default class Client {
|
|
|
1442
1743
|
}
|
|
1443
1744
|
|
|
1444
1745
|
/**
|
|
1746
|
+
* @remarks
|
|
1445
1747
|
* Get bearer token by credential
|
|
1446
|
-
* @
|
|
1748
|
+
* @returns bearer token
|
|
1447
1749
|
*/
|
|
1448
1750
|
async getBearerToken(): Promise<string> {
|
|
1449
1751
|
if (Util.isUnset(this._credential)) {
|
|
@@ -1455,8 +1757,9 @@ export default class Client {
|
|
|
1455
1757
|
}
|
|
1456
1758
|
|
|
1457
1759
|
/**
|
|
1760
|
+
* @remarks
|
|
1458
1761
|
* Get credential type by credential
|
|
1459
|
-
* @
|
|
1762
|
+
* @returns credential type e.g. access_key
|
|
1460
1763
|
*/
|
|
1461
1764
|
async getType(): Promise<string> {
|
|
1462
1765
|
if (Util.isUnset(this._credential)) {
|
|
@@ -1468,10 +1771,12 @@ export default class Client {
|
|
|
1468
1771
|
}
|
|
1469
1772
|
|
|
1470
1773
|
/**
|
|
1774
|
+
* @remarks
|
|
1471
1775
|
* If inputValue is not null, return it or return defaultValue
|
|
1472
|
-
*
|
|
1473
|
-
* @param
|
|
1474
|
-
* @
|
|
1776
|
+
*
|
|
1777
|
+
* @param inputValue - users input value
|
|
1778
|
+
* @param defaultValue - default value
|
|
1779
|
+
* @returns the final result
|
|
1475
1780
|
*/
|
|
1476
1781
|
static defaultAny(inputValue: any, defaultValue: any): any {
|
|
1477
1782
|
if (Util.isUnset(inputValue)) {
|
|
@@ -1482,8 +1787,10 @@ export default class Client {
|
|
|
1482
1787
|
}
|
|
1483
1788
|
|
|
1484
1789
|
/**
|
|
1790
|
+
* @remarks
|
|
1485
1791
|
* If the endpointRule and config.endpoint are empty, throw error
|
|
1486
|
-
*
|
|
1792
|
+
*
|
|
1793
|
+
* @param config - config contains the necessary information to create a client
|
|
1487
1794
|
*/
|
|
1488
1795
|
checkConfig(config: Config): void {
|
|
1489
1796
|
if (Util.empty(this._endpointRule) && Util.empty(config.endpoint)) {
|
|
@@ -1496,22 +1803,27 @@ export default class Client {
|
|
|
1496
1803
|
}
|
|
1497
1804
|
|
|
1498
1805
|
/**
|
|
1806
|
+
* @remarks
|
|
1499
1807
|
* set gateway client
|
|
1500
|
-
*
|
|
1808
|
+
*
|
|
1809
|
+
* @param spi - .
|
|
1501
1810
|
*/
|
|
1502
1811
|
setGatewayClient(spi: SPI): void {
|
|
1503
1812
|
this._spi = spi;
|
|
1504
1813
|
}
|
|
1505
1814
|
|
|
1506
1815
|
/**
|
|
1816
|
+
* @remarks
|
|
1507
1817
|
* set RPC header for debug
|
|
1508
|
-
*
|
|
1818
|
+
*
|
|
1819
|
+
* @param headers - headers for debug, this header can be used only once.
|
|
1509
1820
|
*/
|
|
1510
1821
|
setRpcHeaders(headers: {[key: string ]: string}): void {
|
|
1511
1822
|
this._headers = headers;
|
|
1512
1823
|
}
|
|
1513
1824
|
|
|
1514
1825
|
/**
|
|
1826
|
+
* @remarks
|
|
1515
1827
|
* get RPC header for debug
|
|
1516
1828
|
*/
|
|
1517
1829
|
getRpcHeaders(): {[key: string ]: string} {
|