From 33395afd746f31bfab003f56cf50cd984fc7d3b3 Mon Sep 17 00:00:00 2001 From: Joshua Pinkney Date: Mon, 18 Jul 2022 21:34:55 -0400 Subject: [PATCH] feat(sam): add missing fields to ScheduledEvents and remove required versions from IAM --- ...s-serverless-function_iampolicydocument.go | 4 ++-- .../aws-serverless-function_scheduleevent.go | 15 ++++++++++++++ generate/sam-2016-10-31.json | 20 ++++++++++++++++++- schema/sam.go | 12 +++++++++-- schema/sam.schema.json | 12 +++++++++-- 5 files changed, 56 insertions(+), 7 deletions(-) diff --git a/cloudformation/serverless/aws-serverless-function_iampolicydocument.go b/cloudformation/serverless/aws-serverless-function_iampolicydocument.go index faa7520ff4..8ec4805b58 100644 --- a/cloudformation/serverless/aws-serverless-function_iampolicydocument.go +++ b/cloudformation/serverless/aws-serverless-function_iampolicydocument.go @@ -16,9 +16,9 @@ type Function_IAMPolicyDocument struct { Statement []interface{} `json:"Statement"` // Version AWS CloudFormation Property - // Required: true + // Required: false // See: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html - Version string `json:"Version"` + Version *string `json:"Version,omitempty"` // AWSCloudFormationDeletionPolicy represents a CloudFormation DeletionPolicy AWSCloudFormationDeletionPolicy policies.DeletionPolicy `json:"-"` diff --git a/cloudformation/serverless/aws-serverless-function_scheduleevent.go b/cloudformation/serverless/aws-serverless-function_scheduleevent.go index fdc14b2d89..3a4b676aa2 100644 --- a/cloudformation/serverless/aws-serverless-function_scheduleevent.go +++ b/cloudformation/serverless/aws-serverless-function_scheduleevent.go @@ -10,11 +10,26 @@ import ( // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#schedule type Function_ScheduleEvent struct { + // Description AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#schedule + Description *string `json:"Description,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#schedule + Enabled *bool `json:"Enabled,omitempty"` + // Input AWS CloudFormation Property // Required: false // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#schedule Input *string `json:"Input,omitempty"` + // Name AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#schedule + Name *string `json:"Name,omitempty"` + // Schedule AWS CloudFormation Property // Required: true // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#schedule diff --git a/generate/sam-2016-10-31.json b/generate/sam-2016-10-31.json index d8c42d9ccb..bf2d7e2ab0 100644 --- a/generate/sam-2016-10-31.json +++ b/generate/sam-2016-10-31.json @@ -1242,6 +1242,24 @@ "Required": false, "PrimitiveType": "String", "UpdateType": "Immutable" + }, + "Name": { + "Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#schedule", + "Required": false, + "PrimitiveType": "String", + "UpdateType": "Immutable" + }, + "Description": { + "Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#schedule", + "Required": false, + "PrimitiveType": "String", + "UpdateType": "Immutable" + }, + "Enabled": { + "Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#schedule", + "Required": false, + "PrimitiveType": "Boolean", + "UpdateType": "Immutable" } } }, @@ -1421,7 +1439,7 @@ "Version": { "Documentation": "http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html", "PrimitiveType": "String", - "Required": true, + "Required": false, "UpdateType": "Immutable" } } diff --git a/schema/sam.go b/schema/sam.go index 0d703c6671..8704de66d8 100644 --- a/schema/sam.go +++ b/schema/sam.go @@ -133451,8 +133451,7 @@ var SamSchema = `{ } }, "required": [ - "Statement", - "Version" + "Statement" ], "type": "object" }, @@ -133853,9 +133852,18 @@ var SamSchema = `{ "AWS::Serverless::Function.ScheduleEvent": { "additionalProperties": false, "properties": { + "Description": { + "type": "string" + }, + "Enabled": { + "type": "boolean" + }, "Input": { "type": "string" }, + "Name": { + "type": "string" + }, "Schedule": { "type": "string" } diff --git a/schema/sam.schema.json b/schema/sam.schema.json index a81f24365d..05f48bfebd 100644 --- a/schema/sam.schema.json +++ b/schema/sam.schema.json @@ -133446,8 +133446,7 @@ } }, "required": [ - "Statement", - "Version" + "Statement" ], "type": "object" }, @@ -133848,9 +133847,18 @@ "AWS::Serverless::Function.ScheduleEvent": { "additionalProperties": false, "properties": { + "Description": { + "type": "string" + }, + "Enabled": { + "type": "boolean" + }, "Input": { "type": "string" }, + "Name": { + "type": "string" + }, "Schedule": { "type": "string" }