1
1
// TODO: better import syntax?
2
2
import { BaseAPIRequestFactory , RequiredError } from "./baseapi" ;
3
- import { Configuration , getServer } from "../configuration" ;
3
+ import {
4
+ Configuration ,
5
+ getServer ,
6
+ applySecurityAuthentication ,
7
+ } from "../configuration" ;
4
8
import { RequestContext , HttpMethod , ResponseContext } from "../http/http" ;
5
9
import { ObjectSerializer } from "../models/ObjectSerializer" ;
6
10
import { ApiException } from "./exception" ;
@@ -59,17 +63,11 @@ export class AWSIntegrationApiRequestFactory extends BaseAPIRequestFactory {
59
63
) ;
60
64
requestContext . setBody ( serializedBody ) ;
61
65
62
- let authMethod = null ;
63
66
// Apply auth methods
64
- authMethod = _config . authMethods [ "apiKeyAuth" ] ;
65
- if ( authMethod ) {
66
- await authMethod . applySecurityAuthentication ( requestContext ) ;
67
- }
68
- // Apply auth methods
69
- authMethod = _config . authMethods [ "appKeyAuth" ] ;
70
- if ( authMethod ) {
71
- await authMethod . applySecurityAuthentication ( requestContext ) ;
72
- }
67
+ applySecurityAuthentication ( _config , requestContext , [
68
+ "apiKeyAuth" ,
69
+ "appKeyAuth" ,
70
+ ] ) ;
73
71
74
72
return requestContext ;
75
73
}
@@ -114,17 +112,11 @@ export class AWSIntegrationApiRequestFactory extends BaseAPIRequestFactory {
114
112
) ;
115
113
requestContext . setBody ( serializedBody ) ;
116
114
117
- let authMethod = null ;
118
115
// Apply auth methods
119
- authMethod = _config . authMethods [ "apiKeyAuth" ] ;
120
- if ( authMethod ) {
121
- await authMethod . applySecurityAuthentication ( requestContext ) ;
122
- }
123
- // Apply auth methods
124
- authMethod = _config . authMethods [ "appKeyAuth" ] ;
125
- if ( authMethod ) {
126
- await authMethod . applySecurityAuthentication ( requestContext ) ;
127
- }
116
+ applySecurityAuthentication ( _config , requestContext , [
117
+ "apiKeyAuth" ,
118
+ "appKeyAuth" ,
119
+ ] ) ;
128
120
129
121
return requestContext ;
130
122
}
@@ -169,17 +161,11 @@ export class AWSIntegrationApiRequestFactory extends BaseAPIRequestFactory {
169
161
) ;
170
162
requestContext . setBody ( serializedBody ) ;
171
163
172
- let authMethod = null ;
173
- // Apply auth methods
174
- authMethod = _config . authMethods [ "apiKeyAuth" ] ;
175
- if ( authMethod ) {
176
- await authMethod . applySecurityAuthentication ( requestContext ) ;
177
- }
178
164
// Apply auth methods
179
- authMethod = _config . authMethods [ "appKeyAuth" ] ;
180
- if ( authMethod ) {
181
- await authMethod . applySecurityAuthentication ( requestContext ) ;
182
- }
165
+ applySecurityAuthentication ( _config , requestContext , [
166
+ "apiKeyAuth" ,
167
+ "appKeyAuth" ,
168
+ ] ) ;
183
169
184
170
return requestContext ;
185
171
}
@@ -224,17 +210,11 @@ export class AWSIntegrationApiRequestFactory extends BaseAPIRequestFactory {
224
210
) ;
225
211
requestContext . setBody ( serializedBody ) ;
226
212
227
- let authMethod = null ;
228
- // Apply auth methods
229
- authMethod = _config . authMethods [ "apiKeyAuth" ] ;
230
- if ( authMethod ) {
231
- await authMethod . applySecurityAuthentication ( requestContext ) ;
232
- }
233
213
// Apply auth methods
234
- authMethod = _config . authMethods [ "appKeyAuth" ] ;
235
- if ( authMethod ) {
236
- await authMethod . applySecurityAuthentication ( requestContext ) ;
237
- }
214
+ applySecurityAuthentication ( _config , requestContext , [
215
+ "apiKeyAuth" ,
216
+ "appKeyAuth" ,
217
+ ] ) ;
238
218
239
219
return requestContext ;
240
220
}
@@ -279,17 +259,11 @@ export class AWSIntegrationApiRequestFactory extends BaseAPIRequestFactory {
279
259
) ;
280
260
requestContext . setBody ( serializedBody ) ;
281
261
282
- let authMethod = null ;
283
- // Apply auth methods
284
- authMethod = _config . authMethods [ "apiKeyAuth" ] ;
285
- if ( authMethod ) {
286
- await authMethod . applySecurityAuthentication ( requestContext ) ;
287
- }
288
262
// Apply auth methods
289
- authMethod = _config . authMethods [ "appKeyAuth" ] ;
290
- if ( authMethod ) {
291
- await authMethod . applySecurityAuthentication ( requestContext ) ;
292
- }
263
+ applySecurityAuthentication ( _config , requestContext , [
264
+ "apiKeyAuth" ,
265
+ "appKeyAuth" ,
266
+ ] ) ;
293
267
294
268
return requestContext ;
295
269
}
@@ -340,17 +314,11 @@ export class AWSIntegrationApiRequestFactory extends BaseAPIRequestFactory {
340
314
) ;
341
315
}
342
316
343
- let authMethod = null ;
344
317
// Apply auth methods
345
- authMethod = _config . authMethods [ "apiKeyAuth" ] ;
346
- if ( authMethod ) {
347
- await authMethod . applySecurityAuthentication ( requestContext ) ;
348
- }
349
- // Apply auth methods
350
- authMethod = _config . authMethods [ "appKeyAuth" ] ;
351
- if ( authMethod ) {
352
- await authMethod . applySecurityAuthentication ( requestContext ) ;
353
- }
318
+ applySecurityAuthentication ( _config , requestContext , [
319
+ "apiKeyAuth" ,
320
+ "appKeyAuth" ,
321
+ ] ) ;
354
322
355
323
return requestContext ;
356
324
}
@@ -392,17 +360,11 @@ export class AWSIntegrationApiRequestFactory extends BaseAPIRequestFactory {
392
360
) ;
393
361
}
394
362
395
- let authMethod = null ;
396
- // Apply auth methods
397
- authMethod = _config . authMethods [ "apiKeyAuth" ] ;
398
- if ( authMethod ) {
399
- await authMethod . applySecurityAuthentication ( requestContext ) ;
400
- }
401
363
// Apply auth methods
402
- authMethod = _config . authMethods [ "appKeyAuth" ] ;
403
- if ( authMethod ) {
404
- await authMethod . applySecurityAuthentication ( requestContext ) ;
405
- }
364
+ applySecurityAuthentication ( _config , requestContext , [
365
+ "apiKeyAuth" ,
366
+ "appKeyAuth" ,
367
+ ] ) ;
406
368
407
369
return requestContext ;
408
370
}
@@ -427,17 +389,11 @@ export class AWSIntegrationApiRequestFactory extends BaseAPIRequestFactory {
427
389
requestContext . setHeaderParam ( "Accept" , "application/json" ) ;
428
390
requestContext . setHttpConfig ( _config . httpConfig ) ;
429
391
430
- let authMethod = null ;
431
- // Apply auth methods
432
- authMethod = _config . authMethods [ "apiKeyAuth" ] ;
433
- if ( authMethod ) {
434
- await authMethod . applySecurityAuthentication ( requestContext ) ;
435
- }
436
392
// Apply auth methods
437
- authMethod = _config . authMethods [ "appKeyAuth" ] ;
438
- if ( authMethod ) {
439
- await authMethod . applySecurityAuthentication ( requestContext ) ;
440
- }
393
+ applySecurityAuthentication ( _config , requestContext , [
394
+ "apiKeyAuth" ,
395
+ "appKeyAuth" ,
396
+ ] ) ;
441
397
442
398
return requestContext ;
443
399
}
@@ -508,17 +464,11 @@ export class AWSIntegrationApiRequestFactory extends BaseAPIRequestFactory {
508
464
) ;
509
465
requestContext . setBody ( serializedBody ) ;
510
466
511
- let authMethod = null ;
512
467
// Apply auth methods
513
- authMethod = _config . authMethods [ "apiKeyAuth" ] ;
514
- if ( authMethod ) {
515
- await authMethod . applySecurityAuthentication ( requestContext ) ;
516
- }
517
- // Apply auth methods
518
- authMethod = _config . authMethods [ "appKeyAuth" ] ;
519
- if ( authMethod ) {
520
- await authMethod . applySecurityAuthentication ( requestContext ) ;
521
- }
468
+ applySecurityAuthentication ( _config , requestContext , [
469
+ "apiKeyAuth" ,
470
+ "appKeyAuth" ,
471
+ ] ) ;
522
472
523
473
return requestContext ;
524
474
}
0 commit comments