Skip to content

Commit

Permalink
Add underscore to function name
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinZZ committed Apr 5, 2023
1 parent 36d10a4 commit b8c757a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions samtranslator/model/connector/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
)

SAM_TO_CFN_RESOURCE_TYPE = {
_SAM_TO_CFN_RESOURCE_TYPE = {
SamResourceType.Function.value: LambdaFunction.resource_type,
SamResourceType.StateMachine.value: StepFunctionsStateMachine.resource_type,
SamResourceType.Api.value: ApiGatewayRestApi.resource_type,
Expand Down Expand Up @@ -105,11 +105,6 @@ def _is_valid_resource_reference(obj: Dict[str, Any]) -> bool:
return id_provided != non_id_provided


def get_underlying_cfn_resource_type(resource_type: str) -> str:
"""profiles.json only support CFN resource type. We need to convert SAM resource types to corresponding CFN resource type"""
return SAM_TO_CFN_RESOURCE_TYPE.get(resource_type, resource_type)


def get_resource_reference(
obj: Dict[str, Any], resource_resolver: ResourceResolver, connecting_obj: Dict[str, Any]
) -> ConnectorResourceReference:
Expand All @@ -125,7 +120,10 @@ def get_resource_reference(
resource_type = obj.get("Type")
if not _is_nonblank_str(resource_type):
raise ConnectorResourceError("'Type' is missing or not a string.")
resource_type = get_underlying_cfn_resource_type(str(resource_type))

# profiles.json only support CFN resource type.
# We need to convert SAM resource types to corresponding CFN resource type
resource_type = _SAM_TO_CFN_RESOURCE_TYPE.get(str(resource_type), str(resource_type))

return ConnectorResourceReference(
logical_id=None,
Expand Down

0 comments on commit b8c757a

Please sign in to comment.