Skip to content

Commit

Permalink
expanded help
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Mar 14, 2025
1 parent 71e3325 commit d4b9bf9
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions local-app/python-tools/gfl-resource-actions/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d4b9bf9

Please sign in to comment.