-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
349 additions
and
42 deletions.
There are no files selected for viewing
91 changes: 84 additions & 7 deletions
91
local-app/python-tools/gfl-resource-actions/aws_resource_management/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,90 @@ | ||
| """ | ||
| AWS Resource Management package. | ||
| AWS Resource Management Tool | ||
| A Python-based tool for discovering, starting, stopping, and managing AWS resources | ||
| across multiple accounts, primarily designed for GovCloud environments to help | ||
| with cost management. | ||
| """ | ||
|
|
||
| # Re-export key modules from consolidated utility modules | ||
| from aws_resource_management.utils.logging_utils import ( | ||
| setup_logging, | ||
| __version__ = "1.0.0" | ||
| __author__ = "AWS Resource Management Team" | ||
|
|
||
| # Import core components and expose them at the package level | ||
| from aws_resource_management.core import ResourceManager | ||
| from aws_resource_management.resource_registry import get_registry | ||
| from aws_resource_management.discovery import ResourceDiscovery, get_account_resources | ||
|
|
||
| # Import utility functions from the new consolidated utils package | ||
| from aws_resource_management.utils import ( | ||
| # AWS Core utilities | ||
| get_credentials, | ||
| get_session_for_account, | ||
| get_account_list, | ||
| get_organization_accounts, | ||
|
|
||
| # Logging utilities | ||
| logger, | ||
| log_operation, | ||
| configure_logging, | ||
|
|
||
| # File utilities | ||
| log_action_to_csv, | ||
| write_csv_row, | ||
|
|
||
| # API utilities | ||
| paginate_aws_response, | ||
| format_tags, | ||
|
|
||
| # Region utilities | ||
| # Note: These would be imported from region_utils, but we don't have that file's content | ||
| ) | ||
|
|
||
| # Import the managers package for resource-specific implementations | ||
| from aws_resource_management.managers import ( | ||
| ResourceManager as BaseResourceManager, | ||
| EC2Manager, | ||
| RDSManager, | ||
| ) | ||
|
|
||
| # Set up a default logger | ||
| logger = setup_logging() | ||
| # Try importing optional managers | ||
| try: | ||
| from aws_resource_management.managers import EKSManager | ||
| except ImportError: | ||
| EKSManager = None | ||
|
|
||
| try: | ||
| from aws_resource_management.managers import EMRManager | ||
| except ImportError: | ||
| EMRManager = None | ||
|
|
||
| try: | ||
| from aws_resource_management.managers import ECRManager | ||
| except ImportError: | ||
| ECRManager = None | ||
|
|
||
| # Get the resource registry instance | ||
| registry = get_registry() | ||
|
|
||
| # Export all important components | ||
| __all__ = [ | ||
| "ResourceManager", | ||
| "ResourceDiscovery", | ||
| "get_account_resources", | ||
| "get_registry", | ||
| "registry", | ||
| "BaseResourceManager", | ||
| "EC2Manager", | ||
| "RDSManager", | ||
| "get_credentials", | ||
| "get_session_for_account", | ||
| "logger", | ||
| "configure_logging", | ||
| ] | ||
|
|
||
| __version__ = "0.1.0" | ||
| # Conditionally add optional managers to __all__ | ||
| if EKSManager: | ||
| __all__.append("EKSManager") | ||
| if EMRManager: | ||
| __all__.append("EMRManager") | ||
| if ECRManager: | ||
| __all__.append("ECRManager") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.