-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Test CloudWatchEvent Properties With Intrinsic Functions #2090
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
87a8b0f
Add headers whenever cors is set
mildaniel d0f27b0
Merge branch 'aws:develop' into develop
mildaniel 0d9f504
Add cw event success cases
mildaniel 30f15ad
Replace GetAtt with condition
mildaniel e655ef6
Cleanup test yaml
mildaniel 2dd9ac5
Cleanup test yaml
mildaniel f364587
Merge branch 'Intrinsics-cognito-cwevent' of github.com:mildaniel/ser…
mildaniel a444504
Remove files
mildaniel 81e8ded
Add intrinsic to pattern field
mildaniel b8aa8db
Fix wrong files committed
mildaniel 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 hidden or 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,32 @@ | ||
| Parameters: | ||
| PathA: | ||
| Type: String | ||
| Default: "SomeInputPath" | ||
| PathB: | ||
| Type: String | ||
| Default: "AnotherInputPath" | ||
|
|
||
| Conditions: | ||
| PathCondition: | ||
| Fn::Equals: | ||
| - true | ||
| - true | ||
|
|
||
| Resources: | ||
| LambdaFunction: | ||
| Type: 'AWS::Serverless::Function' | ||
| Properties: | ||
| CodeUri: s3://sam-demo-bucket/hello.zip | ||
| Handler: hello.handler | ||
| Runtime: python2.7 | ||
| Events: | ||
| OnTerminate: | ||
| Type: CloudWatchEvent | ||
| Properties: | ||
| EventBusName: !Join [ "", [ "Event", "Bus", "Name" ] ] | ||
| Pattern: | ||
| detail: | ||
| state: | ||
| - terminated | ||
| Input: !Join [ ":", [ "{ Key", "Value }" ] ] | ||
| InputPath: !If [PathCondition, !Ref PathA, !Ref PathB] | ||
144 changes: 144 additions & 0 deletions
144
tests/translator/output/aws-cn/cloudwatchevent_intrinsics.json
This file contains hidden or 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,144 @@ | ||
| { | ||
| "Parameters": { | ||
| "PathA": { | ||
| "Type": "String", | ||
| "Default": "SomeInputPath" | ||
| }, | ||
| "PathB": { | ||
| "Type": "String", | ||
| "Default": "AnotherInputPath" | ||
| } | ||
| }, | ||
| "Conditions": { | ||
| "PathCondition": { | ||
| "Fn::Equals": [ | ||
| true, | ||
| true | ||
| ] | ||
| } | ||
| }, | ||
| "Resources": { | ||
| "LambdaFunction": { | ||
| "Type": "AWS::Lambda::Function", | ||
| "Properties": { | ||
| "Code": { | ||
| "S3Bucket": "sam-demo-bucket", | ||
| "S3Key": "hello.zip" | ||
| }, | ||
| "Handler": "hello.handler", | ||
| "Role": { | ||
| "Fn::GetAtt": [ | ||
| "LambdaFunctionRole", | ||
| "Arn" | ||
| ] | ||
| }, | ||
| "Runtime": "python2.7", | ||
| "Tags": [ | ||
| { | ||
| "Key": "lambda:createdBy", | ||
| "Value": "SAM" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "LambdaFunctionRole": { | ||
| "Type": "AWS::IAM::Role", | ||
| "Properties": { | ||
| "AssumeRolePolicyDocument": { | ||
| "Version": "2012-10-17", | ||
| "Statement": [ | ||
| { | ||
| "Action": [ | ||
| "sts:AssumeRole" | ||
| ], | ||
| "Effect": "Allow", | ||
| "Principal": { | ||
| "Service": [ | ||
| "lambda.amazonaws.com" | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| "ManagedPolicyArns": [ | ||
| "arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" | ||
| ], | ||
| "Tags": [ | ||
| { | ||
| "Key": "lambda:createdBy", | ||
| "Value": "SAM" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "LambdaFunctionOnTerminate": { | ||
| "Type": "AWS::Events::Rule", | ||
| "Properties": { | ||
| "EventBusName": { | ||
| "Fn::Join": [ | ||
| "", | ||
| [ | ||
| "Event", | ||
| "Bus", | ||
| "Name" | ||
| ] | ||
| ] | ||
| }, | ||
| "EventPattern": { | ||
| "detail": { | ||
| "state": [ | ||
| "terminated" | ||
| ] | ||
| } | ||
| }, | ||
| "Targets": [ | ||
| { | ||
| "Arn": { | ||
| "Fn::GetAtt": [ | ||
| "LambdaFunction", | ||
| "Arn" | ||
| ] | ||
| }, | ||
| "Id": "LambdaFunctionOnTerminateLambdaTarget", | ||
| "Input": { | ||
| "Fn::Join": [ | ||
| ":", | ||
| [ | ||
| "{ Key", | ||
| "Value }" | ||
| ] | ||
| ] | ||
| }, | ||
| "InputPath": { | ||
| "Fn::If": [ | ||
| "PathCondition", | ||
| { | ||
| "Ref": "PathA" | ||
| }, | ||
| { | ||
| "Ref": "PathB" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "LambdaFunctionOnTerminatePermission": { | ||
| "Type": "AWS::Lambda::Permission", | ||
| "Properties": { | ||
| "Action": "lambda:InvokeFunction", | ||
| "FunctionName": { | ||
| "Ref": "LambdaFunction" | ||
| }, | ||
| "Principal": "events.amazonaws.com", | ||
| "SourceArn": { | ||
| "Fn::GetAtt": [ | ||
| "LambdaFunctionOnTerminate", | ||
| "Arn" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
144 changes: 144 additions & 0 deletions
144
tests/translator/output/aws-us-gov/cloudwatchevent_intrinsics.json
This file contains hidden or 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,144 @@ | ||
| { | ||
| "Parameters": { | ||
| "PathA": { | ||
| "Type": "String", | ||
| "Default": "SomeInputPath" | ||
| }, | ||
| "PathB": { | ||
| "Type": "String", | ||
| "Default": "AnotherInputPath" | ||
| } | ||
| }, | ||
| "Conditions": { | ||
| "PathCondition": { | ||
| "Fn::Equals": [ | ||
| true, | ||
| true | ||
| ] | ||
| } | ||
| }, | ||
| "Resources": { | ||
| "LambdaFunction": { | ||
| "Type": "AWS::Lambda::Function", | ||
| "Properties": { | ||
| "Code": { | ||
| "S3Bucket": "sam-demo-bucket", | ||
| "S3Key": "hello.zip" | ||
| }, | ||
| "Handler": "hello.handler", | ||
| "Role": { | ||
| "Fn::GetAtt": [ | ||
| "LambdaFunctionRole", | ||
| "Arn" | ||
| ] | ||
| }, | ||
| "Runtime": "python2.7", | ||
| "Tags": [ | ||
| { | ||
| "Key": "lambda:createdBy", | ||
| "Value": "SAM" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "LambdaFunctionRole": { | ||
| "Type": "AWS::IAM::Role", | ||
| "Properties": { | ||
| "AssumeRolePolicyDocument": { | ||
| "Version": "2012-10-17", | ||
| "Statement": [ | ||
| { | ||
| "Action": [ | ||
| "sts:AssumeRole" | ||
| ], | ||
| "Effect": "Allow", | ||
| "Principal": { | ||
| "Service": [ | ||
| "lambda.amazonaws.com" | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| "ManagedPolicyArns": [ | ||
| "arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" | ||
| ], | ||
| "Tags": [ | ||
| { | ||
| "Key": "lambda:createdBy", | ||
| "Value": "SAM" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "LambdaFunctionOnTerminate": { | ||
| "Type": "AWS::Events::Rule", | ||
| "Properties": { | ||
| "EventBusName": { | ||
| "Fn::Join": [ | ||
| "", | ||
| [ | ||
| "Event", | ||
| "Bus", | ||
| "Name" | ||
| ] | ||
| ] | ||
| }, | ||
| "EventPattern": { | ||
| "detail": { | ||
| "state": [ | ||
| "terminated" | ||
| ] | ||
| } | ||
| }, | ||
| "Targets": [ | ||
| { | ||
| "Arn": { | ||
| "Fn::GetAtt": [ | ||
| "LambdaFunction", | ||
| "Arn" | ||
| ] | ||
| }, | ||
| "Id": "LambdaFunctionOnTerminateLambdaTarget", | ||
| "Input": { | ||
| "Fn::Join": [ | ||
| ":", | ||
| [ | ||
| "{ Key", | ||
| "Value }" | ||
| ] | ||
| ] | ||
| }, | ||
| "InputPath": { | ||
| "Fn::If": [ | ||
| "PathCondition", | ||
| { | ||
| "Ref": "PathA" | ||
| }, | ||
| { | ||
| "Ref": "PathB" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "LambdaFunctionOnTerminatePermission": { | ||
| "Type": "AWS::Lambda::Permission", | ||
| "Properties": { | ||
| "Action": "lambda:InvokeFunction", | ||
| "FunctionName": { | ||
| "Ref": "LambdaFunction" | ||
| }, | ||
| "Principal": "events.amazonaws.com", | ||
| "SourceArn": { | ||
| "Fn::GetAtt": [ | ||
| "LambdaFunctionOnTerminate", | ||
| "Arn" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
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.
Q: are intrinsic functions not supported for this field?
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.
Added an intrinsic here.