in cfn-lint-serverless/cfn_lint_serverless/utils.py [0:0]
def __init__(self, value: Union[dict, str]):
"""
Parse a CloudFormation value
This handles intrinsic functions, such as 'Fn::Sub' and 'Fn::Join' and
returns an object that contains both a uniquely identifiable string and
references to other resources.
"""
self.references = []
# String
if isinstance(value, str):
self.id = value
# Not a dict - return an error here
elif not isinstance(value, dict):
raise ValueError("'value' should be of type str or dict, got '%s'" % type(value))
# 'Ref' intrinsic function
elif "Ref" in value:
self.id, self.references = self._get_from_ref(value["Ref"])
# 'Fn::GetAtt' intrinsic function
elif "Fn::GetAtt" in value:
self.id, self.references = self._get_from_getatt(value["Fn::GetAtt"])
# 'Fn::Join' intrisic function
elif "Fn::Join" in value:
self.id, self.references = self._get_from_join(value["Fn::Join"])
# 'Fn::Sub' intrisic function
elif "Fn::Sub" in value:
self.id, self.references = self._get_from_sub(value["Fn::Sub"])