Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
BenChaimberg committed May 13, 2021
1 parent d4ca56c commit 6903036
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-lambda/lib/function-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ export abstract class FunctionBase extends Resource implements IFunction, ec2.IC
principal: returnPrincipal,
sourceAccount: sourceAccount,
sourceArn: sourceArn,
}
};
};

// Try some specific common classes first.
Expand All @@ -422,9 +422,9 @@ export abstract class FunctionBase extends Resource implements IFunction, ec2.IC
const conditionKeysAreSupported = conditionKeys.every(key => supportedConditions.includes(key));

if (conditionOperatorsAreSupported && conditionKeysAreSupported) {
sourceAccount = conditions['ArnEquals']['aws:SourceAccount'];
sourceArn = conditions['ArnEquals']['aws:SourceArn'];
principal = principal['principal'];
sourceAccount = conditions.ArnEquals['aws:SourceAccount'];
sourceArn = conditions.ArnEquals['aws:SourceArn'];
principal = principal.principal;
} else {
throw new Error(`PrincipalWithConditions had unsupported conditions for Lambda permission statement: ${conditions}. ` +
'Supported operators: [ArnEquals]; supported conditions: [aws:SourceArn, aws:SourceAccount]');
Expand Down
4 changes: 3 additions & 1 deletion packages/@aws-cdk/aws-lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@
"announce": false
},
"nozem": {
"ostools": ["docker"]
"ostools": [
"docker"
]
},
"maturity": "stable",
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-lambda/test/function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,14 @@ describe('function', () => {
'aws:SourceAccount': 'source-account',
'aws:SourceArn': 'source-arn',
},
})
}),
})).toThrow(/PrincipalWithConditions had unsupported conditions for Lambda permission statement/);
expect(() => fn.addPermission('F2', {
principal: new iam.PrincipalWithConditions(new iam.ServicePrincipal('my-service'), {
ArnEquals: {
's3:DataAccessPointArn': 'data-access-point-arn',
},
})
}),
})).toThrow(/PrincipalWithConditions had unsupported conditions for Lambda permission statement/);
});

Expand Down

0 comments on commit 6903036

Please sign in to comment.