Skip to content

Commit

Permalink
Fix PR linter error
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyasdamle committed May 10, 2020
1 parent e41f22e commit c5aa2b2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 12 additions & 0 deletions packages/@aws-cdk/aws-iam/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,18 @@ const newPolicyDocument = PolicyDocument.fromJson(policyDocument);

```
### Policy Statement
As Per the doc of [IAM policy grammar](https://docs.aws.amazon.com/en_us/IAM/latest/UserGuide/reference_policies_grammar.html#policies-grammar-bnf), the action and resource blocks are mandatory. Hence, the new policy stament using `PolicyStatementProps` can be created as:
```ts
const policy = new Policy(stack, 'HelloPolicy', { policyName: 'Default' });
policy.addStatements(new PolicyStatement({
resources: ['*'],
actions: ['sqs:SendMessage']
}));
```
### OpenID Connect Providers
OIDC identity providers are entities in IAM that describe an external identity
Expand Down
3 changes: 1 addition & 2 deletions packages/@aws-cdk/aws-iam/test/policy-document.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ describe('IAM policy document', () => {
test('Throws with invalid not actions', () => {
expect(() => {
new PolicyStatement({
actions: ['abc:def'],
notActions: ['service:action', '*', 'service:acti*', 'in:val:id'],
resources: ['*'],
});
Expand All @@ -104,7 +103,7 @@ describe('IAM policy document', () => {
new PolicyStatement({
actions: ['abc:def'],
resources: ['abc'],
notResources: ['abcd'],
notResources: ['abc'],
});
}).toThrow(/Cannot add 'NotResources' to policy statement if 'Resources' have been added/);
});
Expand Down

0 comments on commit c5aa2b2

Please sign in to comment.