Skip to content

Commit

Permalink
feat(schema): Add new DynamoDBEvent options (awslabs#289)
Browse files Browse the repository at this point in the history
Co-authored-by: Cedric Cordenier <cedric.cordenier@coinbase.com>
  • Loading branch information
cedric-cordenier and Cedric Cordenier authored Jul 21, 2020
1 parent 6cc38fb commit 741228d
Show file tree
Hide file tree
Showing 6 changed files with 260 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package serverless

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

// Function_DestinationConfig AWS CloudFormation Resource (AWS::Serverless::Function.DestinationConfig)
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#destination-config-object
type Function_DestinationConfig struct {

// OnFailure AWS CloudFormation Property
// Required: true
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#destination-config-object
OnFailure *Function_OnFailure `json:"OnFailure,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_DestinationConfig) AWSCloudFormationType() string {
return "AWS::Serverless::Function.DestinationConfig"
}
30 changes: 30 additions & 0 deletions cloudformation/serverless/aws-serverless-function_dynamodbevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,41 @@ type Function_DynamoDBEvent struct {
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb
BatchSize int `json:"BatchSize,omitempty"`

// BisectBatchOnFunctionError AWS CloudFormation Property
// Required: false
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb
BisectBatchOnFunctionError bool `json:"BisectBatchOnFunctionError,omitempty"`

// DestinationConfig AWS CloudFormation Property
// Required: false
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb
DestinationConfig *Function_DestinationConfig `json:"DestinationConfig,omitempty"`

// Enabled AWS CloudFormation Property
// Required: false
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb
Enabled bool `json:"Enabled,omitempty"`

// MaximumBatchingWindowInSeconds AWS CloudFormation Property
// Required: false
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb
MaximumBatchingWindowInSeconds int `json:"MaximumBatchingWindowInSeconds,omitempty"`

// MaximumRecordAgeInSeconds AWS CloudFormation Property
// Required: false
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb
MaximumRecordAgeInSeconds int `json:"MaximumRecordAgeInSeconds,omitempty"`

// MaximumRetryAttempts AWS CloudFormation Property
// Required: false
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb
MaximumRetryAttempts int `json:"MaximumRetryAttempts,omitempty"`

// ParallelizationFactor AWS CloudFormation Property
// Required: false
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb
ParallelizationFactor int `json:"ParallelizationFactor,omitempty"`

// StartingPosition AWS CloudFormation Property
// Required: true
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb
Expand Down
40 changes: 40 additions & 0 deletions cloudformation/serverless/aws-serverless-function_onfailure.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package serverless

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

// Function_OnFailure AWS CloudFormation Resource (AWS::Serverless::Function.OnFailure)
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#destination-config-object
type Function_OnFailure struct {

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

// Type AWS CloudFormation Property
// Required: false
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#destination-config-object
Type string `json:"Type,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_OnFailure) AWSCloudFormationType() string {
return "AWS::Serverless::Function.OnFailure"
}
66 changes: 65 additions & 1 deletion generate/sam-2016-10-31.json
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,43 @@
"Required": false,
"PrimitiveType": "Boolean",
"UpdateType": "Immutable"
}
},
"MaximumBatchingWindowInSeconds": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb",
"Required": false,
"PrimitiveType": "Integer",
"UpdateType": "Immutable"
},
"MaximumRetryAttempts": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb",
"Required": false,
"PrimitiveType": "Integer",
"UpdateType": "Immutable"
},
"BisectBatchOnFunctionError": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb",
"Required": false,
"PrimitiveType": "Boolean",
"UpdateType": "Immutable"
},
"MaximumRecordAgeInSeconds": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb",
"Required": false,
"PrimitiveType": "Integer",
"UpdateType": "Immutable"
},
"DestinationConfig": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb",
"Required": false,
"Type": "DestinationConfig",
"UpdateType": "Immutable"
},
"ParallelizationFactor": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb",
"Required": false,
"PrimitiveType": "Integer",
"UpdateType": "Immutable"
}
}
},
"AWS::Serverless::Function.SQSEvent": {
Expand Down Expand Up @@ -693,6 +729,34 @@
}
}
},
"AWS::Serverless::Function.DestinationConfig": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#destination-config-object",
"Properties": {
"OnFailure": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#destination-config-object",
"Required": true,
"Type": "OnFailure",
"UpdateType": "Immutable"
}
}
},
"AWS::Serverless::Function.OnFailure": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#destination-config-object",
"Properties": {
"Type": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#destination-config-object",
"Required": false,
"PrimitiveType": "String",
"UpdateType": "Immutable"
},
"Destination": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#destination-config-object",
"Required": true,
"PrimitiveType": "String",
"UpdateType": "Immutable"
}
}
},
"AWS::Serverless::Function.EventBridgeRuleEvent": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#eventbridgerule",
"Properties": {
Expand Down
45 changes: 45 additions & 0 deletions schema/sam.go
Original file line number Diff line number Diff line change
Expand Up @@ -63768,6 +63768,18 @@ var SamSchema = `{
},
"type": "object"
},
"AWS::Serverless::Function.DestinationConfig": {
"additionalProperties": false,
"properties": {
"OnFailure": {
"$ref": "#/definitions/AWS::Serverless::Function.OnFailure"
}
},
"required": [
"OnFailure"
],
"type": "object"
},
"AWS::Serverless::Function.DomainSAMPT": {
"additionalProperties": false,
"properties": {
Expand All @@ -63786,9 +63798,27 @@ var SamSchema = `{
"BatchSize": {
"type": "number"
},
"BisectBatchOnFunctionError": {
"type": "boolean"
},
"DestinationConfig": {
"$ref": "#/definitions/AWS::Serverless::Function.DestinationConfig"
},
"Enabled": {
"type": "boolean"
},
"MaximumBatchingWindowInSeconds": {
"type": "number"
},
"MaximumRecordAgeInSeconds": {
"type": "number"
},
"MaximumRetryAttempts": {
"type": "number"
},
"ParallelizationFactor": {
"type": "number"
},
"StartingPosition": {
"type": "string"
},
Expand Down Expand Up @@ -63996,6 +64026,21 @@ var SamSchema = `{
],
"type": "object"
},
"AWS::Serverless::Function.OnFailure": {
"additionalProperties": false,
"properties": {
"Destination": {
"type": "string"
},
"Type": {
"type": "string"
}
},
"required": [
"Destination"
],
"type": "object"
},
"AWS::Serverless::Function.QueueSAMPT": {
"additionalProperties": false,
"properties": {
Expand Down
45 changes: 45 additions & 0 deletions schema/sam.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -63765,6 +63765,18 @@
},
"type": "object"
},
"AWS::Serverless::Function.DestinationConfig": {
"additionalProperties": false,
"properties": {
"OnFailure": {
"$ref": "#/definitions/AWS::Serverless::Function.OnFailure"
}
},
"required": [
"OnFailure"
],
"type": "object"
},
"AWS::Serverless::Function.DomainSAMPT": {
"additionalProperties": false,
"properties": {
Expand All @@ -63783,9 +63795,27 @@
"BatchSize": {
"type": "number"
},
"BisectBatchOnFunctionError": {
"type": "boolean"
},
"DestinationConfig": {
"$ref": "#/definitions/AWS::Serverless::Function.DestinationConfig"
},
"Enabled": {
"type": "boolean"
},
"MaximumBatchingWindowInSeconds": {
"type": "number"
},
"MaximumRecordAgeInSeconds": {
"type": "number"
},
"MaximumRetryAttempts": {
"type": "number"
},
"ParallelizationFactor": {
"type": "number"
},
"StartingPosition": {
"type": "string"
},
Expand Down Expand Up @@ -63993,6 +64023,21 @@
],
"type": "object"
},
"AWS::Serverless::Function.OnFailure": {
"additionalProperties": false,
"properties": {
"Destination": {
"type": "string"
},
"Type": {
"type": "string"
}
},
"required": [
"Destination"
],
"type": "object"
},
"AWS::Serverless::Function.QueueSAMPT": {
"additionalProperties": false,
"properties": {
Expand Down

0 comments on commit 741228d

Please sign in to comment.