From 6a31e5a5c93c15cb7fd0910fd59d48bbd893b2b1 Mon Sep 17 00:00:00 2001 From: Graham Jenson Date: Sat, 20 Jun 2020 23:11:39 -0700 Subject: [PATCH] [Feature] add Serverless FileSystemConfigs --- .../serverless/aws-serverless-function.go | 5 +++ ...ws-serverless-function_filesystemconfig.go | 40 +++++++++++++++++++ generate/sam-2016-10-31.json | 24 +++++++++++ schema/sam.go | 18 +++++++++ schema/sam.schema.json | 18 +++++++++ 5 files changed, 105 insertions(+) create mode 100644 cloudformation/serverless/aws-serverless-function_filesystemconfig.go diff --git a/cloudformation/serverless/aws-serverless-function.go b/cloudformation/serverless/aws-serverless-function.go index 2de9541c8c..e1da3fc8bd 100644 --- a/cloudformation/serverless/aws-serverless-function.go +++ b/cloudformation/serverless/aws-serverless-function.go @@ -47,6 +47,11 @@ type Function struct { // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction Events map[string]Function_EventSource `json:"Events,omitempty"` + // FileSystemConfigs AWS CloudFormation Property + // Required: false + // See: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html + FileSystemConfigs []Function_FileSystemConfig `json:"FileSystemConfigs,omitempty"` + // FunctionName AWS CloudFormation Property // Required: false // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction diff --git a/cloudformation/serverless/aws-serverless-function_filesystemconfig.go b/cloudformation/serverless/aws-serverless-function_filesystemconfig.go new file mode 100644 index 0000000000..c0dad7de26 --- /dev/null +++ b/cloudformation/serverless/aws-serverless-function_filesystemconfig.go @@ -0,0 +1,40 @@ +package serverless + +import ( + "github.com/awslabs/goformation/v4/cloudformation/policies" +) + +// Function_FileSystemConfig AWS CloudFormation Resource (AWS::Serverless::Function.FileSystemConfig) +// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-filesystemconfig.html#cfn-lambda-function-filesystemconfig-localmountpath +type Function_FileSystemConfig struct { + + // Arn AWS CloudFormation Property + // Required: false + // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-filesystemconfig.html#cfn-lambda-function-filesystemconfig-localmountpath + Arn string `json:"Arn,omitempty"` + + // LocalMountPath AWS CloudFormation Property + // Required: false + // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-filesystemconfig.html#cfn-lambda-function-filesystemconfig-localmountpath + LocalMountPath string `json:"LocalMountPath,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_FileSystemConfig) AWSCloudFormationType() string { + return "AWS::Serverless::Function.FileSystemConfig" +} diff --git a/generate/sam-2016-10-31.json b/generate/sam-2016-10-31.json index 318ea996f0..33a66ab35f 100644 --- a/generate/sam-2016-10-31.json +++ b/generate/sam-2016-10-31.json @@ -34,6 +34,13 @@ "PrimitiveType": "String", "UpdateType": "Immutable" }, + "FileSystemConfigs": { + "Documentation": "https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html", + "Required": false, + "Type": "List", + "ItemType": "FileSystemConfig", + "UpdateType": "Immutable" + }, "Description": { "Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction", "Required": false, @@ -424,6 +431,23 @@ } } }, + "AWS::Serverless::Function.FileSystemConfig": { + "Documentation": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-filesystemconfig.html#cfn-lambda-function-filesystemconfig-localmountpath", + "Properties": { + "Arn": { + "Documentation": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-filesystemconfig.html#cfn-lambda-function-filesystemconfig-localmountpath", + "Required": false, + "PrimitiveType": "String", + "UpdateType": "Immutable" + }, + "LocalMountPath": { + "Documentation": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-filesystemconfig.html#cfn-lambda-function-filesystemconfig-localmountpath", + "Required": false, + "PrimitiveType": "String", + "UpdateType": "Immutable" + } + } + }, "AWS::Serverless::Function.EventSource": { "Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#event-source-object", "Properties": { diff --git a/schema/sam.go b/schema/sam.go index 6c9e7ca838..8f7bd9be0b 100644 --- a/schema/sam.go +++ b/schema/sam.go @@ -63405,6 +63405,12 @@ var SamSchema = `{ }, "type": "object" }, + "FileSystemConfigs": { + "items": { + "$ref": "#/definitions/AWS::Serverless::Function.FileSystemConfig" + }, + "type": "array" + }, "FunctionName": { "type": "string" }, @@ -63739,6 +63745,18 @@ var SamSchema = `{ ], "type": "object" }, + "AWS::Serverless::Function.FileSystemConfig": { + "additionalProperties": false, + "properties": { + "Arn": { + "type": "string" + }, + "LocalMountPath": { + "type": "string" + } + }, + "type": "object" + }, "AWS::Serverless::Function.FunctionEnvironment": { "additionalProperties": false, "properties": { diff --git a/schema/sam.schema.json b/schema/sam.schema.json index 7e5321d2ff..122b828797 100644 --- a/schema/sam.schema.json +++ b/schema/sam.schema.json @@ -63402,6 +63402,12 @@ }, "type": "object" }, + "FileSystemConfigs": { + "items": { + "$ref": "#/definitions/AWS::Serverless::Function.FileSystemConfig" + }, + "type": "array" + }, "FunctionName": { "type": "string" }, @@ -63736,6 +63742,18 @@ ], "type": "object" }, + "AWS::Serverless::Function.FileSystemConfig": { + "additionalProperties": false, + "properties": { + "Arn": { + "type": "string" + }, + "LocalMountPath": { + "type": "string" + } + }, + "type": "object" + }, "AWS::Serverless::Function.FunctionEnvironment": { "additionalProperties": false, "properties": {