Skip to content

Commit d2d0655

Browse files
authored
Throw exception when permissions are not provided for connectors (#260)
1 parent d835d91 commit d2d0655

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

tests/translator/input/error_connector.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,20 @@ Resources:
155155
Arn:
156156
Permissions:
157157
- Write
158+
159+
NoPermissionConnector:
160+
Type: AWS::Serverless::Connector
161+
Properties:
162+
Source:
163+
Id: MyFunction
164+
Destination:
165+
Id: MyQueue
166+
167+
EmptyPermissionConnector:
168+
Type: AWS::Serverless::Connector
169+
Properties:
170+
Source:
171+
Id: MyFunction
172+
Destination:
173+
Id: MyQueue
174+
Permission:

tests/translator/output/error_connector.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@
3838
},
3939
{
4040
"errorMessage": "Resource with id [BothIdAndOtherProps] is invalid. Must provide either 'Id' or a combination of the other properties, not both."
41+
},
42+
{
43+
"errorMessage": "Resource with id [NoPermissionConnector] is invalid. Missing required property 'Permissions'"
44+
},
45+
{
46+
"errorMessage": "Resource with id [EmptyPermissionConnector] is invalid. property Permission not defined for resource of type AWS::Serverless::Connector"
4147
}
4248
],
43-
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 13. Resource with id [BothIdAndOtherProps] is invalid. Must provide either 'Id' or a combination of the other properties, not both. Resource with id [MissingLambdaFunctionArn] is invalid. Source.Arn is missing. Resource with id [MissingRole] is invalid. Unable to get IAM role name from 'Source' resource. Resource with id [MissingRoleDestination] is invalid. Unable to get IAM role name from 'Destination' resource. Resource with id [MissingSnsTopicArn] is invalid. Destination.Arn is missing. Resource with id [MissingSqsQueueUrl] is invalid. Destination.Arn is missing. Resource with id [NoIdMissingType] is invalid. 'Type' is missing or not a string. Resource with id [NonExistentLogicalId] is invalid. Unable to find resource with logical ID 'ThisDoesntExist'. Resource with id [NonStrId] is invalid. 'Id' is missing or not a string. Resource with id [ResourceWithoutType] is invalid. 'Type' is missing or not a string. Resource with id [UnsupportedAccessCategory] is invalid. Unsupported 'Permissions' provided; valid values are: Read, Write. Resource with id [UnsupportedAccessCategoryCombination] is invalid. Unsupported 'Permissions' provided; valid combinations are: Read + Write. Resource with id [UnsupportedType] is invalid. Unable to create connector from AWS::Fancy::CoolType to AWS::Lambda::Function; it's not supported or the template is invalid."
49+
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 15. Resource with id [BothIdAndOtherProps] is invalid. Must provide either 'Id' or a combination of the other properties, not both. Resource with id [EmptyPermissionConnector] is invalid. property Permission not defined for resource of type AWS::Serverless::Connector Resource with id [MissingLambdaFunctionArn] is invalid. Source.Arn is missing. Resource with id [MissingRole] is invalid. Unable to get IAM role name from 'Source' resource. Resource with id [MissingRoleDestination] is invalid. Unable to get IAM role name from 'Destination' resource. Resource with id [MissingSnsTopicArn] is invalid. Destination.Arn is missing. Resource with id [MissingSqsQueueUrl] is invalid. Destination.Arn is missing. Resource with id [NoIdMissingType] is invalid. 'Type' is missing or not a string. Resource with id [NoPermissionConnector] is invalid. Missing required property 'Permissions'. Resource with id [NonExistentLogicalId] is invalid. Unable to find resource with logical ID 'ThisDoesntExist'. Resource with id [NonStrId] is invalid. 'Id' is missing or not a string. Resource with id [ResourceWithoutType] is invalid. 'Type' is missing or not a string. Resource with id [UnsupportedAccessCategory] is invalid. Unsupported 'Permissions' provided; valid values are: Read, Write. Resource with id [UnsupportedAccessCategoryCombination] is invalid. Unsupported 'Permissions' provided; valid combinations are: Read + Write. Resource with id [UnsupportedType] is invalid. Unable to create connector from AWS::Fancy::CoolType to AWS::Lambda::Function; it's not supported or the template is invalid."
4450
}

0 commit comments

Comments
 (0)