File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
packages/@aws-cdk/aws-iam/lib Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -287,11 +287,13 @@ export class CompositePrincipal extends PrincipalBase {
287
287
public readonly assumeRoleAction : string ;
288
288
private readonly principals = new Array < PrincipalBase > ( ) ;
289
289
290
- constructor ( principal : PrincipalBase , ...additionalPrincipals : PrincipalBase [ ] ) {
290
+ constructor ( ...principals : PrincipalBase [ ] ) {
291
291
super ( ) ;
292
- this . assumeRoleAction = principal . assumeRoleAction ;
293
- this . addPrincipals ( principal ) ;
294
- this . addPrincipals ( ...additionalPrincipals ) ;
292
+ if ( principals . length === 0 ) {
293
+ throw new Error ( 'CompositePrincipals must be constructed with at least 1 Principal but none were passed.' ) ;
294
+ }
295
+ this . assumeRoleAction = principals [ 0 ] . assumeRoleAction ;
296
+ this . addPrincipals ( ...principals ) ;
295
297
}
296
298
297
299
public addPrincipals ( ...principals : PrincipalBase [ ] ) : this {
You can’t perform that action at this time.
0 commit comments