#!/usr/bin/env python3
# /// script
# requires-python = ">=3.12"
# dependencies = ["botocore"]
# ///
"""Fetch all AWS services from botocore."""

import json

import botocore.session


def get_available_services() -> list[str]:
    """Get all available AWS services from botocore."""
    session = botocore.session.get_session()
    return sorted(session.get_available_services())


def main():
    services = get_available_services()
    print(f"Found {len(services)} AWS services")

    with open("aws_services.json", "w") as f:
        json.dump(services, f, indent=2)

    print("Saved to aws_services.json")


if __name__ == "__main__":
    main()
