diff --git a/local-app/python-tools/gfl-resource-actions/main.py b/local-app/python-tools/gfl-resource-actions/main.py index f7bb649e..47360fba 100644 --- a/local-app/python-tools/gfl-resource-actions/main.py +++ b/local-app/python-tools/gfl-resource-actions/main.py @@ -5,6 +5,7 @@ import argparse import config +import sys from logging_utils import setup_logging from aws_utils import get_available_regions, assume_role, get_organization_accounts from discovery import get_account_resources @@ -22,12 +23,49 @@ def parse_arguments(): parser.add_argument("--exclude-accounts", type=str, help="Comma-separated list of account IDs to exclude") parser.add_argument("--exclude-resources", choices=["ec2", "rds", "eks", "emr"], nargs="+", help="Resource types to exclude from management") + parser.add_argument("--help-detail", action="store_true", help="Show detailed help information and exit") return parser.parse_args() +def show_detailed_help(): + """Show detailed help information about the tool""" + help_text = """ +AWS Organization Resource Management Tool +======================================== + +This tool helps manage AWS resources across multiple accounts in an organization. + +ACTIONS: + stop - Stop running resources (EC2, RDS, EKS, EMR) + start - Start stopped resources + +OPTIONS: + --dry-run - Only show resources that would be affected without making changes + --regions - Specify specific AWS regions to scan (comma separated) + --exclude-accounts - Accounts to skip (comma separated account IDs) + --exclude-resources - Resource types to skip (ec2, rds, eks, emr) + --help-detail - Display this detailed help message + +EXAMPLES: + # Stop all resources in all accounts (dry run mode) + python main.py --action stop --dry-run + + # Start all resources in specific regions + python main.py --action start --regions us-east-1,us-west-2 + + # Stop only EC2 and RDS instances + python main.py --exclude-resources eks emr + """ + print(help_text) + def main(): """Main execution function.""" args = parse_arguments() + # Check if detailed help was requested + if args.help_detail: + show_detailed_help() + sys.exit(0) + # Process arguments action = args.action dry_run = args.dry_run