Skip to content

Commit

Permalink
chore: merge pull request #1280 from awslabs/release/v1.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Shreya authored Dec 2, 2019
2 parents 27b5934 + cf6313f commit 69822c1
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Resources:
Type: CloudWatchEvent
Description: Detects EC2 Security Group Events to Send to Teams
Properties:
EventBusName: event-bus-name
Pattern:
source:
- "aws.ec2"
Expand Down
2 changes: 1 addition & 1 deletion samtranslator/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.16.0'
__version__ = '1.17.0'
1 change: 1 addition & 0 deletions samtranslator/model/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class EventsRule(Resource):
resource_type = 'AWS::Events::Rule'
property_types = {
'Description': PropertyType(False, is_str()),
'EventBusName': PropertyType(False, is_str()),
'EventPattern': PropertyType(False, is_type(dict)),
'Name': PropertyType(False, is_str()),
'RoleArn': PropertyType(False, is_str()),
Expand Down
2 changes: 2 additions & 0 deletions samtranslator/model/eventsources/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class CloudWatchEvent(PushEventSource):
resource_type = 'CloudWatchEvent'
principal = 'events.amazonaws.com'
property_types = {
'EventBusName': PropertyType(False, is_str()),
'Pattern': PropertyType(False, is_type(dict)),
'Input': PropertyType(False, is_str()),
'InputPath': PropertyType(False, is_str())
Expand All @@ -164,6 +165,7 @@ def to_cloudformation(self, **kwargs):
resources = []

events_rule = EventsRule(self.logical_id)
events_rule.EventBusName = self.EventBusName
events_rule.EventPattern = self.Pattern
events_rule.Targets = [self._construct_target(function)]
if CONDITION in function.resource_attributes:
Expand Down
3 changes: 3 additions & 0 deletions samtranslator/validator/sam_schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@
"AWS::Serverless::Function.CloudWatchEventEvent": {
"additionalProperties": false,
"properties": {
"EventBusName": {
"type": "string"
},
"Input": {
"type": "string"
},
Expand Down
1 change: 1 addition & 0 deletions tests/translator/input/cloudwatchevent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Resources:
OnTerminate:
Type: CloudWatchEvent
Properties:
EventBusName: ExternalEventBridge
Pattern:
detail:
state:
Expand Down
1 change: 1 addition & 0 deletions tests/translator/output/aws-cn/cloudwatchevent.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
]
}
},
"EventBusName": "ExternalEventBridge",
"Targets": [
{
"Id": "TriggeredFunctionOnTerminateLambdaTarget",
Expand Down
1 change: 1 addition & 0 deletions tests/translator/output/aws-us-gov/cloudwatchevent.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
]
}
},
"EventBusName": "ExternalEventBridge",
"Targets": [
{
"Id": "TriggeredFunctionOnTerminateLambdaTarget",
Expand Down
1 change: 1 addition & 0 deletions tests/translator/output/cloudwatchevent.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
]
}
},
"EventBusName": "ExternalEventBridge",
"Targets": [
{
"Id": "TriggeredFunctionOnTerminateLambdaTarget",
Expand Down
1 change: 1 addition & 0 deletions versions/2016-10-31.md
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ The object describing an event source with type `CloudWatchEvent`.
Property Name | Type | Description
---|:---:|---
Pattern | [Event Pattern Object](http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html) | **Required.** Pattern describing which CloudWatch events trigger the function. Only matching events trigger the function.
EventBusName | `string` | The event bus to associate with this rule. If you omit this, the default event bus is used.
Input | `string` | JSON-formatted string to pass to the function as the event body. This value overrides the matched event.
InputPath | `string` | JSONPath describing the part of the event to pass to the function.

Expand Down

0 comments on commit 69822c1

Please sign in to comment.