diff --git a/samtranslator/internal/schema_source/aws_serverless_function.py b/samtranslator/internal/schema_source/aws_serverless_function.py index 811f37d1b..869993798 100644 --- a/samtranslator/internal/schema_source/aws_serverless_function.py +++ b/samtranslator/internal/schema_source/aws_serverless_function.py @@ -76,6 +76,7 @@ class CodeUri(BaseModel): Bucket: SamIntrinsicable[str] = codeuri("Bucket") Key: SamIntrinsicable[str] = codeuri("Key") Version: SamIntrinsicable[str] | None = codeuri("Version") + StorageMode: SamIntrinsicable[str] | None = codeuri("StorageMode") class Hooks(BaseModel): diff --git a/samtranslator/internal/schema_source/aws_serverless_layerversion.py b/samtranslator/internal/schema_source/aws_serverless_layerversion.py index fefa8d0ca..300cbb6d8 100644 --- a/samtranslator/internal/schema_source/aws_serverless_layerversion.py +++ b/samtranslator/internal/schema_source/aws_serverless_layerversion.py @@ -34,6 +34,11 @@ class ContentUri(BaseModel): "Version", ["AWS::Lambda::LayerVersion.Content", "S3ObjectVersion"], ) + StorageMode: PassThroughProp | None = passthrough_prop( + CONTENT_URI_STEM, + "StorageMode", + ["AWS::Lambda::LayerVersion.Content", "S3ObjectStorageMode"], + ) class Properties(BaseModel): diff --git a/samtranslator/internal/schema_source/sam-docs.json b/samtranslator/internal/schema_source/sam-docs.json index 1242ad857..7a2309072 100644 --- a/samtranslator/internal/schema_source/sam-docs.json +++ b/samtranslator/internal/schema_source/sam-docs.json @@ -270,6 +270,7 @@ "sam-property-function-functioncode": { "Bucket": "An Amazon S3 bucket in the same AWS Region as your function. \n*Type*: String \n*Required*: Yes \n*CloudFormation compatibility*: This property is passed directly to the [`S3Bucket`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-s3bucket) property of the `AWS::Lambda::Function` `Code` data type.", "Key": "The Amazon S3 key of the deployment package. \n*Type*: String \n*Required*: Yes \n*CloudFormation compatibility*: This property is passed directly to the [`S3Key`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-s3key) property of the `AWS::Lambda::Function` `Code` data type.", + "StorageMode": "Controls how Lambda stores the deployment package. Valid values: `COPY` (Lambda copies the object to its own storage; the object can be deleted after function creation) and `REFERENCE` (Lambda references the object in your S3 bucket; the object must remain in place for the lifetime of the function). \n*Type*: String \n*Required*: No \n*CloudFormation compatibility*: This property is passed directly to the [`S3ObjectStorageMode`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-s3objectstoragemode) property of the `AWS::Lambda::Function` `Code` data type.", "Version": "For versioned objects, the version of the deployment package object to use. \n*Type*: String \n*Required*: No \n*CloudFormation compatibility*: This property is passed directly to the [`S3ObjectVersion`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-s3objectversion) property of the `AWS::Lambda::Function` `Code` data type." }, "sam-property-function-functionscalingconfig": { @@ -609,6 +610,7 @@ "sam-property-layerversion-layercontent": { "Bucket": "The Amazon S3 bucket of the layer archive. \n*Type*: String \n*Required*: Yes \n*CloudFormation compatibility*: This property is passed directly to the [`S3Bucket`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-layerversion-content.html#cfn-lambda-layerversion-content-s3bucket) property of the `AWS::Lambda::LayerVersion` `Content` data type.", "Key": "The Amazon S3 key of the layer archive. \n*Type*: String \n*Required*: Yes \n*CloudFormation compatibility*: This property is passed directly to the [`S3Key`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-layerversion-content.html#cfn-lambda-layerversion-content-s3key) property of the `AWS::Lambda::LayerVersion` `Content` data type.", + "StorageMode": "Controls how Lambda stores the layer archive. Valid values: `COPY` (Lambda copies the object to its own storage; the object can be deleted after layer creation) and `REFERENCE` (Lambda references the object in your S3 bucket; the object must remain in place for the lifetime of the layer version). \n*Type*: String \n*Required*: No \n*CloudFormation compatibility*: This property is passed directly to the [`S3ObjectStorageMode`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-layerversion-content.html#cfn-lambda-layerversion-content-s3objectstoragemode) property of the `AWS::Lambda::LayerVersion` `Content` data type.", "Version": "For versioned objects, the version of the layer archive object to use. \n*Type*: String \n*Required*: No \n*CloudFormation compatibility*: This property is passed directly to the [`S3ObjectVersion`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-layerversion-content.html#cfn-lambda-layerversion-content-s3objectversion) property of the `AWS::Lambda::LayerVersion` `Content` data type." }, "sam-property-simpletable-primarykeyobject": { @@ -996,4 +998,4 @@ "NetworkProtocol": "The network protocol for the VPC egress connection. \n*Valid values*: `IPv4`, `DualStack` \n*Type*: String \n*Required*: Yes \n*CloudFormation compatibility*: This property is passed directly to the [`NetworkProtocol`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-lambda-networkconnector-vpcegressconfiguration.html#cfn-lambda-networkconnector-vpcegressconfiguration-networkprotocol) property of `Configuration.VpcEgressConfiguration` of an `AWS::Lambda::NetworkConnector` resource." } } -} \ No newline at end of file +} diff --git a/samtranslator/model/s3_utils/uri_parser.py b/samtranslator/model/s3_utils/uri_parser.py index 44617999c..21d5fb8c5 100644 --- a/samtranslator/model/s3_utils/uri_parser.py +++ b/samtranslator/model/s3_utils/uri_parser.py @@ -123,4 +123,6 @@ def construct_s3_location_object( code = {"S3Bucket": s3_pointer["Bucket"], "S3Key": s3_pointer["Key"]} if "Version" in s3_pointer: code["S3ObjectVersion"] = s3_pointer["Version"] + if "StorageMode" in s3_pointer: + code["S3ObjectStorageMode"] = s3_pointer["StorageMode"] return code diff --git a/samtranslator/schema/schema.json b/samtranslator/schema/schema.json index 98f334781..c1b92229b 100644 --- a/samtranslator/schema/schema.json +++ b/samtranslator/schema/schema.json @@ -191395,6 +191395,8 @@ "type": "string" }, "S3ObjectStorageMode": { + "markdownDescription": "Controls how Lambda stores the deployment package: `COPY` (Lambda copies the object to its own storage) or `REFERENCE` (Lambda references the object in your S3 bucket; the object must remain in place for the lifetime of the function).", + "title": "S3ObjectStorageMode", "type": "string" }, "S3ObjectVersion": { @@ -191801,6 +191803,11 @@ "title": "S3Key", "type": "string" }, + "S3ObjectStorageMode": { + "markdownDescription": "Controls how Lambda stores the layer archive: `COPY` (Lambda copies the object to its own storage) or `REFERENCE` (Lambda references the object in your S3 bucket; the object must remain in place for the lifetime of the layer version).", + "title": "S3ObjectStorageMode", + "type": "string" + }, "S3ObjectVersion": { "markdownDescription": "For versioned objects, the version of the layer archive object to use.", "title": "S3ObjectVersion", @@ -365032,6 +365039,18 @@ "markdownDescription": "The Amazon S3 key of the deployment package. \n*Type*: String \n*Required*: Yes \n*CloudFormation compatibility*: This property is passed directly to the [`S3Key`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-s3key) property of the `AWS::Lambda::Function` `Code` data type.", "title": "Key" }, + "StorageMode": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "string" + } + ], + "markdownDescription": "Controls how Lambda stores the deployment package. Valid values: `COPY` (Lambda copies the object to its own storage; the object can be deleted after function creation) and `REFERENCE` (Lambda references the object in your S3 bucket; the object must remain in place for the lifetime of the function). \n*Type*: String \n*Required*: No \n*CloudFormation compatibility*: This property is passed directly to the [`S3ObjectStorageMode`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-s3objectstoragemode) property of the `AWS::Lambda::Function` `Code` data type.", + "title": "StorageMode" + }, "Version": { "anyOf": [ { @@ -365193,6 +365212,11 @@ "title": "Key", "type": "string" }, + "StorageMode": { + "markdownDescription": "Controls how Lambda stores the layer archive. Valid values: `COPY` (Lambda copies the object to its own storage; the object can be deleted after layer creation) and `REFERENCE` (Lambda references the object in your S3 bucket; the object must remain in place for the lifetime of the layer version). \n*Type*: String \n*Required*: No \n*CloudFormation compatibility*: This property is passed directly to the [`S3ObjectStorageMode`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-layerversion-content.html#cfn-lambda-layerversion-content-s3objectstoragemode) property of the `AWS::Lambda::LayerVersion` `Content` data type.", + "title": "StorageMode", + "type": "string" + }, "Version": { "markdownDescription": "For versioned objects, the version of the layer archive object to use. \n*Type*: String \n*Required*: No \n*CloudFormation compatibility*: This property is passed directly to the [`S3ObjectVersion`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-layerversion-content.html#cfn-lambda-layerversion-content-s3objectversion) property of the `AWS::Lambda::LayerVersion` `Content` data type.", "title": "Version", diff --git a/schema_source/cloudformation.schema.json b/schema_source/cloudformation.schema.json index 31b99af07..d6ef0c323 100644 --- a/schema_source/cloudformation.schema.json +++ b/schema_source/cloudformation.schema.json @@ -191346,6 +191346,8 @@ "type": "string" }, "S3ObjectStorageMode": { + "markdownDescription": "Controls how Lambda stores the deployment package: `COPY` (Lambda copies the object to its own storage) or `REFERENCE` (Lambda references the object in your S3 bucket; the object must remain in place for the lifetime of the function).", + "title": "S3ObjectStorageMode", "type": "string" }, "S3ObjectVersion": { @@ -191752,6 +191754,11 @@ "title": "S3Key", "type": "string" }, + "S3ObjectStorageMode": { + "markdownDescription": "Controls how Lambda stores the layer archive: `COPY` (Lambda copies the object to its own storage) or `REFERENCE` (Lambda references the object in your S3 bucket; the object must remain in place for the lifetime of the layer version).", + "title": "S3ObjectStorageMode", + "type": "string" + }, "S3ObjectVersion": { "markdownDescription": "For versioned objects, the version of the layer archive object to use.", "title": "S3ObjectVersion", diff --git a/schema_source/sam.schema.json b/schema_source/sam.schema.json index 11cb241d9..3fafb03b3 100644 --- a/schema_source/sam.schema.json +++ b/schema_source/sam.schema.json @@ -457,6 +457,18 @@ "markdownDescription": "The Amazon S3 key of the deployment package. \n*Type*: String \n*Required*: Yes \n*CloudFormation compatibility*: This property is passed directly to the [`S3Key`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-s3key) property of the `AWS::Lambda::Function` `Code` data type.", "title": "Key" }, + "StorageMode": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "string" + } + ], + "markdownDescription": "Controls how Lambda stores the deployment package. Valid values: `COPY` (Lambda copies the object to its own storage; the object can be deleted after function creation) and `REFERENCE` (Lambda references the object in your S3 bucket; the object must remain in place for the lifetime of the function). \n*Type*: String \n*Required*: No \n*CloudFormation compatibility*: This property is passed directly to the [`S3ObjectStorageMode`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-s3objectstoragemode) property of the `AWS::Lambda::Function` `Code` data type.", + "title": "StorageMode" + }, "Version": { "anyOf": [ { @@ -642,6 +654,23 @@ ], "title": "Key" }, + "StorageMode": { + "__samPassThrough": { + "markdownDescriptionOverride": "Controls how Lambda stores the layer archive. Valid values: `COPY` (Lambda copies the object to its own storage; the object can be deleted after layer creation) and `REFERENCE` (Lambda references the object in your S3 bucket; the object must remain in place for the lifetime of the layer version). \n*Type*: String \n*Required*: No \n*CloudFormation compatibility*: This property is passed directly to the [`S3ObjectStorageMode`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-layerversion-content.html#cfn-lambda-layerversion-content-s3objectstoragemode) property of the `AWS::Lambda::LayerVersion` `Content` data type.", + "schemaPath": [ + "definitions", + "AWS::Lambda::LayerVersion.Content", + "properties", + "S3ObjectStorageMode" + ] + }, + "allOf": [ + { + "$ref": "#/definitions/PassThroughProp" + } + ], + "title": "StorageMode" + }, "Version": { "__samPassThrough": { "markdownDescriptionOverride": "For versioned objects, the version of the layer archive object to use. \n*Type*: String \n*Required*: No \n*CloudFormation compatibility*: This property is passed directly to the [`S3ObjectVersion`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-layerversion-content.html#cfn-lambda-layerversion-content-s3objectversion) property of the `AWS::Lambda::LayerVersion` `Content` data type.", diff --git a/tests/translator/input/function_with_s3_object_storage_mode.yaml b/tests/translator/input/function_with_s3_object_storage_mode.yaml new file mode 100644 index 000000000..6b512b0f0 --- /dev/null +++ b/tests/translator/input/function_with_s3_object_storage_mode.yaml @@ -0,0 +1,22 @@ +Resources: + FunctionWithCopyMode: + Type: AWS::Serverless::Function + Properties: + CodeUri: + Bucket: somebucket + Key: somekey + Version: '1' + StorageMode: COPY + Handler: hello.handler + Runtime: python3.12 + + FunctionWithReferenceMode: + Type: AWS::Serverless::Function + Properties: + CodeUri: + Bucket: somebucket + Key: somekey + Version: '1' + StorageMode: REFERENCE + Handler: hello.handler + Runtime: python3.12 diff --git a/tests/translator/input/layer_with_s3_object_storage_mode.yaml b/tests/translator/input/layer_with_s3_object_storage_mode.yaml new file mode 100644 index 000000000..09c35ce60 --- /dev/null +++ b/tests/translator/input/layer_with_s3_object_storage_mode.yaml @@ -0,0 +1,26 @@ +Metadata: + # cfn-lint's bundled CFN schema does not yet recognize S3ObjectStorageMode on + # AWS::Lambda::LayerVersion.Content. Suppress E3002 until upstream catches up. + cfn-lint: + config: + ignore_checks: + - E3002 + +Resources: + LayerWithCopyMode: + Type: AWS::Serverless::LayerVersion + Properties: + ContentUri: + Bucket: somebucket + Key: somekey + Version: '1' + StorageMode: COPY + + LayerWithReferenceMode: + Type: AWS::Serverless::LayerVersion + Properties: + ContentUri: + Bucket: somebucket + Key: somekey + Version: '1' + StorageMode: REFERENCE diff --git a/tests/translator/output/aws-cn/function_with_s3_object_storage_mode.json b/tests/translator/output/aws-cn/function_with_s3_object_storage_mode.json new file mode 100644 index 000000000..68c5f72b4 --- /dev/null +++ b/tests/translator/output/aws-cn/function_with_s3_object_storage_mode.json @@ -0,0 +1,114 @@ +{ + "Resources": { + "FunctionWithCopyMode": { + "Properties": { + "Code": { + "S3Bucket": "somebucket", + "S3Key": "somekey", + "S3ObjectStorageMode": "COPY", + "S3ObjectVersion": "1" + }, + "Handler": "hello.handler", + "Role": { + "Fn::GetAtt": [ + "FunctionWithCopyModeRole", + "Arn" + ] + }, + "Runtime": "python3.12", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::Lambda::Function" + }, + "FunctionWithCopyModeRole": { + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + "arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::IAM::Role" + }, + "FunctionWithReferenceMode": { + "Properties": { + "Code": { + "S3Bucket": "somebucket", + "S3Key": "somekey", + "S3ObjectStorageMode": "REFERENCE", + "S3ObjectVersion": "1" + }, + "Handler": "hello.handler", + "Role": { + "Fn::GetAtt": [ + "FunctionWithReferenceModeRole", + "Arn" + ] + }, + "Runtime": "python3.12", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::Lambda::Function" + }, + "FunctionWithReferenceModeRole": { + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + "arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::IAM::Role" + } + } +} diff --git a/tests/translator/output/aws-cn/layer_with_s3_object_storage_mode.json b/tests/translator/output/aws-cn/layer_with_s3_object_storage_mode.json new file mode 100644 index 000000000..8ff4517ea --- /dev/null +++ b/tests/translator/output/aws-cn/layer_with_s3_object_storage_mode.json @@ -0,0 +1,39 @@ +{ + "Metadata": { + "cfn-lint": { + "config": { + "ignore_checks": [ + "E3002" + ] + } + } + }, + "Resources": { + "LayerWithCopyModee8d50fb359": { + "DeletionPolicy": "Retain", + "Properties": { + "Content": { + "S3Bucket": "somebucket", + "S3Key": "somekey", + "S3ObjectStorageMode": "COPY", + "S3ObjectVersion": "1" + }, + "LayerName": "LayerWithCopyMode" + }, + "Type": "AWS::Lambda::LayerVersion" + }, + "LayerWithReferenceMode0ed616eec0": { + "DeletionPolicy": "Retain", + "Properties": { + "Content": { + "S3Bucket": "somebucket", + "S3Key": "somekey", + "S3ObjectStorageMode": "REFERENCE", + "S3ObjectVersion": "1" + }, + "LayerName": "LayerWithReferenceMode" + }, + "Type": "AWS::Lambda::LayerVersion" + } + } +} diff --git a/tests/translator/output/aws-us-gov/function_with_s3_object_storage_mode.json b/tests/translator/output/aws-us-gov/function_with_s3_object_storage_mode.json new file mode 100644 index 000000000..41d7fe937 --- /dev/null +++ b/tests/translator/output/aws-us-gov/function_with_s3_object_storage_mode.json @@ -0,0 +1,114 @@ +{ + "Resources": { + "FunctionWithCopyMode": { + "Properties": { + "Code": { + "S3Bucket": "somebucket", + "S3Key": "somekey", + "S3ObjectStorageMode": "COPY", + "S3ObjectVersion": "1" + }, + "Handler": "hello.handler", + "Role": { + "Fn::GetAtt": [ + "FunctionWithCopyModeRole", + "Arn" + ] + }, + "Runtime": "python3.12", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::Lambda::Function" + }, + "FunctionWithCopyModeRole": { + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + "arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::IAM::Role" + }, + "FunctionWithReferenceMode": { + "Properties": { + "Code": { + "S3Bucket": "somebucket", + "S3Key": "somekey", + "S3ObjectStorageMode": "REFERENCE", + "S3ObjectVersion": "1" + }, + "Handler": "hello.handler", + "Role": { + "Fn::GetAtt": [ + "FunctionWithReferenceModeRole", + "Arn" + ] + }, + "Runtime": "python3.12", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::Lambda::Function" + }, + "FunctionWithReferenceModeRole": { + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + "arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::IAM::Role" + } + } +} diff --git a/tests/translator/output/aws-us-gov/layer_with_s3_object_storage_mode.json b/tests/translator/output/aws-us-gov/layer_with_s3_object_storage_mode.json new file mode 100644 index 000000000..8ff4517ea --- /dev/null +++ b/tests/translator/output/aws-us-gov/layer_with_s3_object_storage_mode.json @@ -0,0 +1,39 @@ +{ + "Metadata": { + "cfn-lint": { + "config": { + "ignore_checks": [ + "E3002" + ] + } + } + }, + "Resources": { + "LayerWithCopyModee8d50fb359": { + "DeletionPolicy": "Retain", + "Properties": { + "Content": { + "S3Bucket": "somebucket", + "S3Key": "somekey", + "S3ObjectStorageMode": "COPY", + "S3ObjectVersion": "1" + }, + "LayerName": "LayerWithCopyMode" + }, + "Type": "AWS::Lambda::LayerVersion" + }, + "LayerWithReferenceMode0ed616eec0": { + "DeletionPolicy": "Retain", + "Properties": { + "Content": { + "S3Bucket": "somebucket", + "S3Key": "somekey", + "S3ObjectStorageMode": "REFERENCE", + "S3ObjectVersion": "1" + }, + "LayerName": "LayerWithReferenceMode" + }, + "Type": "AWS::Lambda::LayerVersion" + } + } +} diff --git a/tests/translator/output/function_with_s3_object_storage_mode.json b/tests/translator/output/function_with_s3_object_storage_mode.json new file mode 100644 index 000000000..72102775d --- /dev/null +++ b/tests/translator/output/function_with_s3_object_storage_mode.json @@ -0,0 +1,114 @@ +{ + "Resources": { + "FunctionWithCopyMode": { + "Properties": { + "Code": { + "S3Bucket": "somebucket", + "S3Key": "somekey", + "S3ObjectStorageMode": "COPY", + "S3ObjectVersion": "1" + }, + "Handler": "hello.handler", + "Role": { + "Fn::GetAtt": [ + "FunctionWithCopyModeRole", + "Arn" + ] + }, + "Runtime": "python3.12", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::Lambda::Function" + }, + "FunctionWithCopyModeRole": { + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::IAM::Role" + }, + "FunctionWithReferenceMode": { + "Properties": { + "Code": { + "S3Bucket": "somebucket", + "S3Key": "somekey", + "S3ObjectStorageMode": "REFERENCE", + "S3ObjectVersion": "1" + }, + "Handler": "hello.handler", + "Role": { + "Fn::GetAtt": [ + "FunctionWithReferenceModeRole", + "Arn" + ] + }, + "Runtime": "python3.12", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::Lambda::Function" + }, + "FunctionWithReferenceModeRole": { + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::IAM::Role" + } + } +} diff --git a/tests/translator/output/layer_with_s3_object_storage_mode.json b/tests/translator/output/layer_with_s3_object_storage_mode.json new file mode 100644 index 000000000..8ff4517ea --- /dev/null +++ b/tests/translator/output/layer_with_s3_object_storage_mode.json @@ -0,0 +1,39 @@ +{ + "Metadata": { + "cfn-lint": { + "config": { + "ignore_checks": [ + "E3002" + ] + } + } + }, + "Resources": { + "LayerWithCopyModee8d50fb359": { + "DeletionPolicy": "Retain", + "Properties": { + "Content": { + "S3Bucket": "somebucket", + "S3Key": "somekey", + "S3ObjectStorageMode": "COPY", + "S3ObjectVersion": "1" + }, + "LayerName": "LayerWithCopyMode" + }, + "Type": "AWS::Lambda::LayerVersion" + }, + "LayerWithReferenceMode0ed616eec0": { + "DeletionPolicy": "Retain", + "Properties": { + "Content": { + "S3Bucket": "somebucket", + "S3Key": "somekey", + "S3ObjectStorageMode": "REFERENCE", + "S3ObjectVersion": "1" + }, + "LayerName": "LayerWithReferenceMode" + }, + "Type": "AWS::Lambda::LayerVersion" + } + } +}