in source/lambda/quicksight-custom-resources/util/quicksight_application.py [0:0]
def __init__(self, resource_properties):
# TODO: use the config data / file to figure out the supported_data_set_types
supported_data_set_types = ["image-text", "topic", "image-moderation-label", "geo", "topic-mapping", "feed"]
self.resource_properties = resource_properties
self.global_state = get_global_state()
# use config data file if provided
config_file = resource_properties.get("ConfigDataFile", None)
if config_file:
data = read_config(config_file)
self.global_state.update(data)
self.prefix = resource_properties.get("StackName", "Sample_Sol")
# TODO:RENAME: quicksight_template_arn -> quicksight_source_template_arn
self.quicksight_template_arn = resource_properties.get(
"QuickSightSourceTemplateArn", "Uninitialized QuickSightSourceTemplateArn"
)
logger.debug(f"Using QuickSightSourceTemplateArn: {self.quicksight_template_arn }")
self.quicksight_principal_arn = resource_properties.get(
"QuickSightPrincipalArn", "Uninitialized QuickSightPrincipalArn"
)
logger.debug(f"Using QuickSightPrincipalArn: {self.quicksight_principal_arn }")
self.data_source = DataSource(quicksight_application=self, props=self.global_state)
self.data_source.athena_workgroup = resource_properties.get("WorkGroupName", "primary")
self.data_set_sub_types = supported_data_set_types
self.data_sets = dict()
for data_set_sub_type in self.data_set_sub_types:
data_set = DataSet(
quicksight_application=self,
data_source=self.data_source,
data_set_sub_type=data_set_sub_type,
props=self.global_state,
)
self.data_sets[data_set_sub_type] = data_set
self.analysis = Analysis(
quicksight_application=self,
data_sets=self.data_sets,
quicksight_template_arn=self.quicksight_template_arn,
data_source=self.data_source,
props=self.global_state,
)
self.dashboard = Dashboard(
quicksight_application=self,
data_source=self.data_source,
data_sets=self.data_sets,
quicksight_template_arn=self.quicksight_template_arn,
props=self.global_state,
)
self.template = Template(quicksight_application=self, data_sets=self.data_sets, props=self.global_state)
global_state_json = json.dumps(self.global_state, indent=2, sort_keys=True)
logger.debug(f"QuicksightApi: after init, global data json: {global_state_json}")