diff --git a/cloudformation/serverless/aws-serverless-function_eventbridgeruleevent.go b/cloudformation/serverless/aws-serverless-function_eventbridgeruleevent.go new file mode 100644 index 0000000000..09870ab695 --- /dev/null +++ b/cloudformation/serverless/aws-serverless-function_eventbridgeruleevent.go @@ -0,0 +1,50 @@ +package serverless + +import ( + "github.com/awslabs/goformation/v4/cloudformation/policies" +) + +// Function_EventBridgeRuleEvent AWS CloudFormation Resource (AWS::Serverless::Function.EventBridgeRuleEvent) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#eventbridgerule +type Function_EventBridgeRuleEvent struct { + + // EventBusName AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#eventbridgerule + EventBusName string `json:"EventBusName,omitempty"` + + // Input AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#eventbridgerule + Input string `json:"Input,omitempty"` + + // InputPath AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#eventbridgerule + InputPath string `json:"InputPath,omitempty"` + + // Pattern AWS CloudFormation Property + // Required: true + // See: https://docs.aws.amazon.com/eventbridge/latest/userguide/filtering-examples-structure.html + Pattern interface{} `json:"Pattern,omitempty"` + + // AWSCloudFormationDeletionPolicy represents a CloudFormation DeletionPolicy + AWSCloudFormationDeletionPolicy policies.DeletionPolicy `json:"-"` + + // AWSCloudFormationUpdateReplacePolicy represents a CloudFormation UpdateReplacePolicy + AWSCloudFormationUpdateReplacePolicy policies.UpdateReplacePolicy `json:"-"` + + // AWSCloudFormationDependsOn stores the logical ID of the resources to be created before this resource + AWSCloudFormationDependsOn []string `json:"-"` + + // AWSCloudFormationMetadata stores structured data associated with this resource + AWSCloudFormationMetadata map[string]interface{} `json:"-"` + + // AWSCloudFormationCondition stores the logical ID of the condition that must be satisfied for this resource to be created + AWSCloudFormationCondition string `json:"-"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *Function_EventBridgeRuleEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.EventBridgeRuleEvent" +} diff --git a/cloudformation/serverless/function_properties.go b/cloudformation/serverless/function_properties.go index 2fd8e36be7..c00b031d38 100644 --- a/cloudformation/serverless/function_properties.go +++ b/cloudformation/serverless/function_properties.go @@ -7,7 +7,7 @@ import ( "github.com/awslabs/goformation/v4/cloudformation/utils" ) -// Function_Properties is a helper struct that can hold either a S3Event, SNSEvent, SQSEvent, KinesisEvent, DynamoDBEvent, ApiEvent, ScheduleEvent, CloudWatchEventEvent, CloudWatchLogsEvent, IoTRuleEvent, or AlexaSkillEvent value +// Function_Properties is a helper struct that can hold either a S3Event, SNSEvent, SQSEvent, KinesisEvent, DynamoDBEvent, ApiEvent, ScheduleEvent, CloudWatchEventEvent, CloudWatchLogsEvent, IoTRuleEvent, AlexaSkillEvent, or EventBridgeRuleEvent value type Function_Properties struct { S3Event *Function_S3Event SNSEvent *Function_SNSEvent @@ -20,6 +20,7 @@ type Function_Properties struct { CloudWatchLogsEvent *Function_CloudWatchLogsEvent IoTRuleEvent *Function_IoTRuleEvent AlexaSkillEvent *Function_AlexaSkillEvent + EventBridgeRuleEvent *Function_EventBridgeRuleEvent } func (r Function_Properties) value() interface{} { @@ -69,6 +70,10 @@ func (r Function_Properties) value() interface{} { ret = append(ret, *r.AlexaSkillEvent) } + if r.EventBridgeRuleEvent != nil { + ret = append(ret, *r.EventBridgeRuleEvent) + } + sort.Sort(utils.ByJSONLength(ret)) // Heuristic to select best attribute if len(ret) > 0 { return ret[0] @@ -117,6 +122,8 @@ func (r *Function_Properties) UnmarshalJSON(b []byte) error { json.Unmarshal(b, &r.AlexaSkillEvent) + json.Unmarshal(b, &r.EventBridgeRuleEvent) + case []interface{}: } diff --git a/generate/sam-2016-10-31.json b/generate/sam-2016-10-31.json index 8a5a8d0728..318ea996f0 100644 --- a/generate/sam-2016-10-31.json +++ b/generate/sam-2016-10-31.json @@ -447,7 +447,8 @@ "CloudWatchEventEvent", "CloudWatchLogsEvent", "IoTRuleEvent", - "AlexaSkillEvent" + "AlexaSkillEvent", + "EventBridgeRuleEvent" ], "UpdateType": "Immutable" } @@ -692,6 +693,35 @@ } } }, + "AWS::Serverless::Function.EventBridgeRuleEvent": { + "Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#eventbridgerule", + "Properties": { + "Pattern": { + "Documentation": "https://docs.aws.amazon.com/eventbridge/latest/userguide/filtering-examples-structure.html", + "Required": true, + "PrimitiveType": "Json", + "UpdateType": "Immutable" + }, + "EventBusName": { + "Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#eventbridgerule", + "Required": false, + "PrimitiveType": "String", + "UpdateType": "Immutable" + }, + "Input": { + "Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#eventbridgerule", + "Required": false, + "PrimitiveType": "String", + "UpdateType": "Immutable" + }, + "InputPath": { + "Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#eventbridgerule", + "Required": false, + "PrimitiveType": "String", + "UpdateType": "Immutable" + } + } + }, "AWS::Serverless::Function.VpcConfig": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-vpcconfig.html", "Properties": { @@ -1263,4 +1293,4 @@ } } } -} \ No newline at end of file +}