-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQS: support bucket notifications #564
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { Construct, DeletionPolicy, Output, PolicyDocument, PolicyStatement } from '@aws-cdk/cdk'; | ||
import { Construct, DeletionPolicy, Output, PolicyDocument, PolicyStatement, resolve } from '@aws-cdk/cdk'; | ||
import { EncryptionKeyAlias } from './alias'; | ||
import { cloudformation, KeyArn } from './kms.generated'; | ||
|
||
|
@@ -54,10 +54,15 @@ export abstract class EncryptionKeyRef extends Construct { | |
|
||
/** | ||
* Adds a statement to the KMS key resource policy. | ||
* @param statement The policy statement to add | ||
* @param allowNoOp If this is set to `false` and there is no policy | ||
* defined (i.e. external key), the operation will fail. Otherwise, it will | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align the text for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What?! how is this related to my sphinx output? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is my sphinx output: .. py:method:: addToResourcePolicy(statement, [allowNoOp])
Adds a statement to the KMS key resource policy.
:param statement: The policy statement to add
:type statement: :py:class:`@aws-cdk/cdk.PolicyStatement`
:param allowNoOp: If this is set to `false` and there is no policy defined (i.e. external key), the operation will fail. Otherwise, it will no-op.
:type allowNoOp: boolean or undefined Looks fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Weird. I had bunch of cases where this generated invalid |
||
* no-op. | ||
*/ | ||
public addToResourcePolicy(statement: PolicyStatement) { | ||
public addToResourcePolicy(statement: PolicyStatement, allowNoOp = true) { | ||
if (!this.policy) { | ||
return; | ||
if (allowNoOp) { return; } | ||
throw new Error(`Unable to add statement to IAM resource policy for KMS key: ${JSON.stringify(resolve(this.keyArn))}`); | ||
} | ||
|
||
this.policy.addStatement(statement); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point I would
import cdk = require('@aws-cdk/cdk');
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll forgive me - I forgot to push this change and merged. We'll clean this up later.