def create_if_not_exists_namespace()

in src/pkg/qs_user_gov.py [0:0]


def create_if_not_exists_namespace(user):
    """
    check to see if a namespace exists in a QuickSight Account.
    If not, create it.
    """

    try:
        QS_CLIENT.describe_namespace(AwsAccountId=user.account_id, Namespace=user.namespace)
    except ClientError:
        QS_CLIENT.create_namespace(
            AwsAccountId=user.account_id, Namespace=user.namespace, IdentityStore='QUICKSIGHT'
        )
        time.sleep(120)
        LOGGER.info(f"Namespace [{user.namespace}] created.")