{
  "output": "import boto3\nfrom botocore.exceptions import ClientError, ProfileNotFound\nfrom aws_utils import setup_org_accounts_session\n\n\ndef list_rds_instances(rds_client):\n    instance_names = []\n    paginator = rds_client.get_paginator(\"describe_db_instances\")\n    for page in paginator.paginate():\n        for db_instance in page[\"DBInstances\"]:\n            instance_names.append(db_instance[\"DBInstanceIdentifier\"])\n    return instance_names\n\n\ndef list_rds_clusters(rds_client):\n    cluster_names = []\n    paginator = rds_client.get_paginator(\"describe_db_clusters\")\n    for page in paginator.paginate():\n        for db_cluster in page[\"DBClusters\"]:\n            cluster_names.append(db_cluster[\"DBClusterIdentifier\"])\n    return cluster_names\n\n\ndef main():\n    for account, profile_name in setup_org_accounts_session():\n        account_id = account[\"Id\"]\n        account_name = account[\"Name\"]\n        try:\n            boto3.setup_default_session(profile_name=profile_name)\n            rds_client = boto3.client(\"rds\")\n\n            names = list_rds_instances(rds_client) + list_rds_clusters(rds_client)\n            for name in names:\n                print(f'\"{account_name}\":\"{name}\"')\n\n            print(f\"Processed account '{account_name}' (ID: {account_id})\")\n        except (ClientError, ProfileNotFound) as e:\n            print(f\"Error accessing account '{account_name}': {e}\")\n\n    print(\"\\nRDS names have been successfully listed for all accounts.\")\n\n\nif __name__ == \"__main__\":\n    main()\n"
}