in source/lambda/quicksight-custom-resources/util/quicksight_resource.py [0:0]
def _initialize_identity(self):
"""
Initialize the identity attributes of the quicksight resource. These initial
value may be overwritten after the constructure is called if needed.
Examples of resource names: my-stack1_datasource, my-stack1_dataset_image-text,
my-stack1-dataset_sentiment, my-stack1_analysis
"""
postfix = "-" + self.type
if self.sub_type and self.sub_type != "main":
postfix += f"-{self.sub_type}"
# Automatically generate a default name based on the prefix, resource type and sub-type
# Truncate prefix to keep overall length to be no longer than 80 characters. A conservative boundary
# Limit of 150 for arn
max_length = 80
name = self.prefix[0 : max_length - len(postfix)] + postfix
# Use the same value for name and id. The id should be unique since it is
# includes the stack name (assuming not getting truncated)
self.id = name
self.name = name
self._update_arn()
self._update_url()