in cid/helpers/quicksight.py [0:0]
def describe_dashboard(self, poll: bool=False, **kwargs) -> Union[None, Dashboard]:
""" Describes an AWS QuickSight dashboard
Keyword arguments:
DashboardId
"""
poll_interval = kwargs.get('poll_interval', 1)
try:
dashboard: Dashboard = None
current_status = None
# Poll for the current status of query as long as its not finished
while current_status in [None, 'CREATION_IN_PROGRESS', 'UPDATE_IN_PROGRESS']:
if current_status:
logger.info(f'Dashboard {dashboard.name} status is {current_status}, waiting for {poll_interval} seconds')
# Sleep before polling again
time.sleep(poll_interval)
elif poll:
logger.info(f'Polling for dashboard {kwargs.get("DashboardId")}')
response = self.client.describe_dashboard(AwsAccountId=self.account_id, **kwargs).get('Dashboard')
logger.debug(response)
dashboard = Dashboard(response)
current_status = dashboard.version.get('Status')
if not poll:
break
logger.info(f'Dashboard {dashboard.name} status is {current_status}')
return dashboard
except self.client.exceptions.ResourceNotFoundException:
return None
except self.client.exceptions.UnsupportedUserEditionException:
print('Error: AWS QuickSight Enterprise Edition is required')
exit(1)
except Exception as e:
print(f'Error: {e}')
raise