Skip to content

Commit 6603b30

Browse files
authored
Revert "Add feature toggle around connector macro" (#262)
* Revert "Add feature toggle around connector macro" This reverts commit e4f0d437d2f070835960a2d5c8c43b16a1b8c42a. * Fix error_connector expected message
1 parent 358a19c commit 6603b30

File tree

5 files changed

+8
-343
lines changed

5 files changed

+8
-343
lines changed

samtranslator/translator/translator.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ def translate(self, sam_template, parameter_values, feature_toggle=None, passthr
131131
document_errors = []
132132
changed_logical_ids = {}
133133
route53_record_set_groups = {}
134-
for logical_id, resource_dict in self._get_resources_to_iterate(
135-
sam_template, macro_resolver, self.feature_toggle
136-
):
134+
for logical_id, resource_dict in self._get_resources_to_iterate(sam_template, macro_resolver):
137135
try:
138136
macro = macro_resolver.resolve_resource_type(resource_dict).from_dict(
139137
logical_id, resource_dict, sam_plugins=sam_plugins
@@ -214,7 +212,7 @@ def translate(self, sam_template, parameter_values, feature_toggle=None, passthr
214212
raise InvalidDocumentException(document_errors)
215213

216214
# private methods
217-
def _get_resources_to_iterate(self, sam_template, macro_resolver, feature_toggle: FeatureToggle):
215+
def _get_resources_to_iterate(self, sam_template, macro_resolver):
218216
"""
219217
Returns a list of resources to iterate, order them based on the following order:
220218
@@ -253,9 +251,7 @@ def _get_resources_to_iterate(self, sam_template, macro_resolver, feature_toggle
253251
elif resource["Type"] == "AWS::Serverless::Api" or resource["Type"] == "AWS::Serverless::HttpApi":
254252
apis.append(data)
255253
elif resource["Type"] == "AWS::Serverless::Connector":
256-
if feature_toggle.is_enabled("connector"):
257-
# Skip connectors if feature toggle is not on
258-
connectors.append(data)
254+
connectors.append(data)
259255
else:
260256
others.append(data)
261257

tests/translator/input/translate_connector_without_feature_toggle_on.yaml

Lines changed: 0 additions & 103 deletions
This file was deleted.

tests/translator/output/error_connector.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@
4949
"errorMessage": "Resource with id [EmptyListPermissionConnector] is invalid. property Permission not defined for resource of type AWS::Serverless::Connector"
5050
}
5151
],
52-
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 16. Resource with id [BothIdAndOtherProps] is invalid. Must provide either 'Id' or a combination of the other properties, not both. Resource with id [EmptyListPermissionConnector] is invalid. 'Permissions' can not be empty; valid values are: Read, Write. Resource with id [EmptyPermissionConnector] is invalid. Missing required property 'Permissions'. 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."
52+
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 16. Resource with id [BothIdAndOtherProps] is invalid. Must provide either 'Id' or a combination of the other properties, not both. Resource with id [EmptyListPermissionConnector] is invalid. 'Permissions' cannot be empty; valid values are: Read, Write. Resource with id [EmptyPermissionConnector] is invalid. Missing required property 'Permissions'. 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."
5353
}

tests/translator/output/translate_connector_without_feature_toggle_on.json

Lines changed: 0 additions & 207 deletions
This file was deleted.

0 commit comments

Comments
 (0)