Skip to content
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

[Feature] adding the cloudwatch logs event to from SAM #271

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package serverless

import (
"github.com/awslabs/goformation/v4/cloudformation/policies"
)

// Function_CloudWatchLogsEvent AWS CloudFormation Resource (AWS::Serverless::Function.CloudWatchLogsEvent)
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#cloudwatchevent
type Function_CloudWatchLogsEvent struct {

// FilterPattern AWS CloudFormation Property
// Required: true
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#cloudwatchlogs
FilterPattern string `json:"FilterPattern,omitempty"`

// LogGroupName AWS CloudFormation Property
// Required: true
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#cloudwatchlogs
LogGroupName string `json:"LogGroupName,omitempty"`

// AWSCloudFormationDeletionPolicy represents a CloudFormation DeletionPolicy
AWSCloudFormationDeletionPolicy policies.DeletionPolicy `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_CloudWatchLogsEvent) AWSCloudFormationType() string {
return "AWS::Serverless::Function.CloudWatchLogsEvent"
}
9 changes: 8 additions & 1 deletion cloudformation/serverless/function_properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, 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, or AlexaSkillEvent value
type Function_Properties struct {
S3Event *Function_S3Event
SNSEvent *Function_SNSEvent
Expand All @@ -17,6 +17,7 @@ type Function_Properties struct {
ApiEvent *Function_ApiEvent
ScheduleEvent *Function_ScheduleEvent
CloudWatchEventEvent *Function_CloudWatchEventEvent
CloudWatchLogsEvent *Function_CloudWatchLogsEvent
IoTRuleEvent *Function_IoTRuleEvent
AlexaSkillEvent *Function_AlexaSkillEvent
}
Expand Down Expand Up @@ -56,6 +57,10 @@ func (r Function_Properties) value() interface{} {
ret = append(ret, *r.CloudWatchEventEvent)
}

if r.CloudWatchLogsEvent != nil {
ret = append(ret, *r.CloudWatchLogsEvent)
}

if r.IoTRuleEvent != nil {
ret = append(ret, *r.IoTRuleEvent)
}
Expand Down Expand Up @@ -106,6 +111,8 @@ func (r *Function_Properties) UnmarshalJSON(b []byte) error {

json.Unmarshal(b, &r.CloudWatchEventEvent)

json.Unmarshal(b, &r.CloudWatchLogsEvent)

json.Unmarshal(b, &r.IoTRuleEvent)

json.Unmarshal(b, &r.AlexaSkillEvent)
Expand Down
18 changes: 18 additions & 0 deletions generate/sam-2016-10-31.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@
"ApiEvent",
"ScheduleEvent",
"CloudWatchEventEvent",
"CloudWatchLogsEvent",
"IoTRuleEvent",
"AlexaSkillEvent"
],
Expand Down Expand Up @@ -639,6 +640,23 @@
}
}
},
"AWS::Serverless::Function.CloudWatchLogsEvent": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#cloudwatchevent",
"Properties": {
"LogGroupName": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#cloudwatchlogs",
"Required": true,
"PrimitiveType": "String",
"UpdateType": "Immutable"
},
"FilterPattern": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#cloudwatchlogs",
"Required": true,
"PrimitiveType": "String",
"UpdateType": "Immutable"
}
}
},
"AWS::Serverless::Function.IoTRuleEvent": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#iotrule",
"Properties": {
Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
module github.com/awslabs/goformation/v4

require (
github.com/awslabs/goformation/v3 v3.1.0
github.com/imdario/mergo v0.3.6
github.com/onsi/ginkgo v1.5.0
github.com/onsi/gomega v1.2.0
github.com/sanathkr/go-yaml v0.0.0-20170819195128-ed9d249f429b
github.com/sanathkr/yaml v0.0.0-20170819201035-0056894fa522
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v0.0.0-20181112162635-ac52e6811b56
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
)

go 1.13
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ github.com/xeipuuv/gojsonschema v0.0.0-20181112162635-ac52e6811b56/go.mod h1:5yf
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20191021144547-ec77196f6094 h1:5O4U9trLjNpuhpynaDsqwCk+Tw6seqJz1EbqbnzHrc8=
golang.org/x/net v0.0.0-20191021144547-ec77196f6094/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
Expand All @@ -47,3 +49,5 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
19 changes: 19 additions & 0 deletions schema/sam.go
Original file line number Diff line number Diff line change
Expand Up @@ -55101,6 +55101,22 @@ var SamSchema = `{
],
"type": "object"
},
"AWS::Serverless::Function.CloudWatchLogsEvent": {
"additionalProperties": false,
"properties": {
"FilterPattern": {
"type": "string"
},
"LogGroupName": {
"type": "string"
}
},
"required": [
"FilterPattern",
"LogGroupName"
],
"type": "object"
},
"AWS::Serverless::Function.CollectionSAMPT": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -55227,6 +55243,9 @@ var SamSchema = `{
{
"$ref": "#/definitions/AWS::Serverless::Function.CloudWatchEventEvent"
},
{
"$ref": "#/definitions/AWS::Serverless::Function.CloudWatchLogsEvent"
},
{
"$ref": "#/definitions/AWS::Serverless::Function.IoTRuleEvent"
},
Expand Down
19 changes: 19 additions & 0 deletions schema/sam.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -55098,6 +55098,22 @@
],
"type": "object"
},
"AWS::Serverless::Function.CloudWatchLogsEvent": {
"additionalProperties": false,
"properties": {
"FilterPattern": {
"type": "string"
},
"LogGroupName": {
"type": "string"
}
},
"required": [
"FilterPattern",
"LogGroupName"
],
"type": "object"
},
"AWS::Serverless::Function.CollectionSAMPT": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -55224,6 +55240,9 @@
{
"$ref": "#/definitions/AWS::Serverless::Function.CloudWatchEventEvent"
},
{
"$ref": "#/definitions/AWS::Serverless::Function.CloudWatchLogsEvent"
},
{
"$ref": "#/definitions/AWS::Serverless::Function.IoTRuleEvent"
},
Expand Down