-
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
fix: update all 'onXxx' methods to be CloudWatch Events #2609
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4908eb0
fix: update all 'onXxx' methods to be CloudWatch Events
rix0rrr 048333f
Merge remote-tracking branch 'origin/master' into huijbers/events-on-…
rix0rrr 432fa2f
Fix awslint
rix0rrr ecf226f
Merge remote-tracking branch 'origin/master' into huijbers/events-on-…
rix0rrr 482d15e
Fix config uses
rix0rrr 3be7222
Update readme
rix0rrr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Some sample CloudTrail events | ||
|
||
For reference. | ||
|
||
|
||
## S3 | ||
|
||
PutObject | ||
|
||
{ | ||
"eventSource": "s3.amazonaws.com", | ||
"resources": [ | ||
{ | ||
"ARN": "arn:aws:s3:::BUCKETNAME/OBJECTKEY", | ||
"type": "AWS::S3::Object" | ||
}, | ||
{ | ||
"accountId": "123456789012", | ||
"ARN": "arn:aws:s3:::BUCKETNAME", | ||
"type": "AWS::S3::Bucket" | ||
} | ||
], | ||
"eventTime": "2019-05-22T08:38:05Z", | ||
"userAgent": "[aws-cli/1.16.96 Python/2.7.12 Linux/4.4.0-146-generic botocore/1.12.86]", | ||
"readOnly": false, | ||
"recipientAccountId": "123456789012", | ||
"awsRegion": "eu-west-1", | ||
"requestID": "CF9748DFDC5FB0A4", | ||
"additionalEventData": { | ||
"CipherSuite": "ECDHE-RSA-AES128-GCM-SHA256", | ||
"bytesTransferredOut": 0, | ||
"AuthenticationMethod": "AuthHeader", | ||
"x-amz-id-2": "hRJMAs5p4ALZIabP4ATIL53npWU61+N6LYWj02gdQtR0ymKSySzVXUSZx7ydv7tRJwk+XMaPerM=", | ||
"bytesTransferredIn": 197, | ||
"SignatureVersion": "SigV4" | ||
}, | ||
"eventType": "AwsApiCall", | ||
"eventID": "3074546e-1bfa-4973-8502-b1bb4d0bda1a", | ||
"eventVersion": "1.05", | ||
"eventName": "PutObject", | ||
"sourceIPAddress": "1.2.3.4", | ||
"userIdentity": { | ||
"accountId": "123456789012", | ||
"type": "AssumedRole", | ||
"principalId": "AROAJBNCAL3UTR5C42U4M:user-SomeRole", | ||
"accessKeyId": "AZYCAIJERO6H7", | ||
"sessionContext": { | ||
"attributes": { | ||
"mfaAuthenticated": "false", | ||
"creationDate": "2019-05-22T08:10:21Z" | ||
}, | ||
"sessionIssuer": { | ||
"accountId": "123456789012", | ||
"type": "Role", | ||
"principalId": "AROAJBNCAL3UTR5C42U4M", | ||
"userName": "SomeRole", | ||
"arn": "arn:aws:iam::123456789012:role/SomeRole" | ||
} | ||
}, | ||
"arn": "arn:aws:sts::123456789012:assumed-role/SomeRole/user-SomeRole" | ||
}, | ||
"responseElements": null, | ||
"requestParameters": { | ||
"bucketName": "BUCKETNAME", | ||
"Host": "BUCKETNAME.s3.eu-west-1.amazonaws.com", | ||
"key": "OBJECTKEY" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I guess I missed this in the previous PR, but it's now or never: I kind of think that "target" shouldn't be under "Options", so I can do
onEvent('foo', target)
.It also maps more cleanly to the fact that you pass in
options
toevents.Rule
and thenaddTarget
separately.I would also say that
events.RuleProps
should containtargets
(plural) to allow adding targets declaratively...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.
I was bivaricating on that. I found the API very ugly that way.
Hmm.
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.
Actually, here's why I changed the signature: the signature with 3 arguments becomes very ugly if you have a complex target (such as an ECS task or CodeBuild project), or a complex payload (from a JSON message), and then also configuration after it.
It would look something like this:
vs:
I feel the bad case is a lot worse for the first API, where the 2nd API fixes that, and the regular case isn't THAT much worse.
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.
Also, I think
obj.method('id', { ...props... })
is more consistent with most of our other APIs.