runbooks 1.1.6__py3-none-any.whl → 1.1.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
runbooks/__init__.py CHANGED
@@ -61,7 +61,7 @@ s3_ops = S3Operations()
61
61
 
62
62
  # Centralized Version Management - Single Source of Truth
63
63
  # All modules MUST import __version__ from this location
64
- __version__ = "1.1.5"
64
+ __version__ = "1.1.7"
65
65
 
66
66
  # Fallback for legacy importlib.metadata usage during transition
67
67
  try:
@@ -14,8 +14,14 @@ import click
14
14
  # DRY Pattern Manager - eliminates duplication across CLI modules
15
15
  from runbooks.common.patterns import get_console, get_error_handlers, get_click_group_creator, get_common_decorators
16
16
 
17
- # Import common utilities and decorators
18
- from runbooks.common.decorators import common_aws_options
17
+ # Import unified CLI decorators (v1.1.7 standardization)
18
+ from runbooks.common.cli_decorators import (
19
+ common_aws_options,
20
+ common_output_options,
21
+ common_multi_account_options,
22
+ common_filter_options,
23
+ mcp_validation_option
24
+ )
19
25
 
20
26
  # Single console instance shared across all modules (DRY principle)
21
27
  console = get_console()
@@ -47,9 +53,13 @@ def create_finops_group():
47
53
  """
48
54
 
49
55
  @click.group(invoke_without_command=True)
56
+ @common_filter_options
57
+ @common_multi_account_options
58
+ @common_output_options
50
59
  @common_aws_options
51
60
  @click.pass_context
52
- def finops(ctx, profile, region, dry_run):
61
+ def finops(ctx, profile, region, dry_run, output_format, output_dir, export,
62
+ all_profiles, profiles, regions, all_regions, tags, accounts):
53
63
  """
54
64
  Financial operations and cost optimization for AWS resources.
55
65
 
@@ -64,13 +74,27 @@ def create_finops_group():
64
74
 
65
75
  Examples:
66
76
  runbooks finops dashboard --profile billing-profile
67
- runbooks finops analyze --service ec2 --timeframe monthly
77
+ runbooks finops dashboard --all-profiles --timeframe monthly
78
+ runbooks finops dashboard --regions us-east-1 us-west-2
68
79
  runbooks finops export --format pdf --output-dir ./reports
69
80
  """
70
81
  # Ensure context object exists
71
82
  if ctx.obj is None:
72
83
  ctx.obj = {}
73
- ctx.obj.update({"profile": profile, "region": region, "dry_run": dry_run})
84
+ ctx.obj.update({
85
+ "profile": profile,
86
+ "region": region,
87
+ "dry_run": dry_run,
88
+ "output_format": output_format,
89
+ "output_dir": output_dir,
90
+ "export": export,
91
+ "all_profiles": all_profiles,
92
+ "profiles": profiles,
93
+ "regions": regions,
94
+ "all_regions": all_regions,
95
+ "tags": tags,
96
+ "accounts": accounts
97
+ })
74
98
 
75
99
  if ctx.invoked_subcommand is None:
76
100
  click.echo(ctx.get_help())
@@ -12,8 +12,14 @@ import click
12
12
  import os
13
13
  import sys
14
14
 
15
- # Import common utilities and decorators
16
- from runbooks.common.decorators import common_aws_options, common_output_options, common_filter_options
15
+ # Import unified CLI decorators (v1.1.7 standardization)
16
+ from runbooks.common.cli_decorators import (
17
+ common_aws_options,
18
+ common_output_options,
19
+ common_multi_account_options,
20
+ common_filter_options,
21
+ mcp_validation_option
22
+ )
17
23
 
18
24
  # Test Mode Support: Disable Rich Console in test environments to prevent I/O conflicts
19
25
  # Issue: Rich Console writes to StringIO buffer that Click CliRunner closes, causing ValueError
@@ -60,11 +66,13 @@ def create_inventory_group():
60
66
  """
61
67
 
62
68
  @click.group(invoke_without_command=True)
63
- @common_aws_options
64
- @common_output_options
65
69
  @common_filter_options
70
+ @common_multi_account_options
71
+ @common_output_options
72
+ @common_aws_options
66
73
  @click.pass_context
67
- def inventory(ctx, profile, region, dry_run, output_format, output_file, tags, accounts, regions):
74
+ def inventory(ctx, profile, region, dry_run, output_format, output_dir, export,
75
+ all_profiles, profiles, regions, all_regions, tags, accounts):
68
76
  """
69
77
  Universal AWS resource discovery and inventory - works with ANY AWS environment.
70
78
 
@@ -95,10 +103,14 @@ def create_inventory_group():
95
103
  "region": region,
96
104
  "dry_run": dry_run,
97
105
  "output_format": output_format,
98
- "output_file": output_file,
106
+ "output_dir": output_dir,
107
+ "export": export,
108
+ "all_profiles": all_profiles,
109
+ "profiles": profiles,
110
+ "regions": regions,
111
+ "all_regions": all_regions,
99
112
  "tags": tags,
100
113
  "accounts": accounts,
101
- "regions": regions,
102
114
  }
103
115
  )
104
116
 
@@ -193,3 +193,64 @@ def all_standard_options(f: Callable) -> Callable:
193
193
  return f(*args, **kwargs)
194
194
 
195
195
  return wrapper
196
+
197
+
198
+ def common_multi_account_options(f: Callable) -> Callable:
199
+ """
200
+ Multi-account and multi-region AWS options for enterprise operations.
201
+
202
+ Provides:
203
+ - --all-profiles: Process all configured AWS profiles (multi-account)
204
+ - --profiles: [LEGACY] Specific profiles (use --all-profiles for all)
205
+ - --regions: Specific AWS regions (space-separated)
206
+ - --all-regions: Process all enabled AWS regions
207
+
208
+ Note: --profile is provided by common_aws_options decorator
209
+
210
+ Usage:
211
+ @common_multi_account_options
212
+ @common_aws_options
213
+ @click.command()
214
+ def my_command(profile, all_profiles, profiles, regions, all_regions, **kwargs):
215
+ # Multi-account command logic
216
+ """
217
+
218
+ @click.option('--all-profiles', is_flag=True, default=False,
219
+ help='Process all configured AWS profiles (multi-account)')
220
+ @click.option('--profiles', type=str, multiple=True,
221
+ help='[LEGACY] Specific profiles (use --all-profiles for all)')
222
+ @click.option('--regions', type=str, multiple=True,
223
+ help='Specific AWS regions (space-separated)')
224
+ @click.option('--all-regions', is_flag=True, default=False,
225
+ help='Process all enabled AWS regions')
226
+ @wraps(f)
227
+ def wrapper(*args, **kwargs):
228
+ return f(*args, **kwargs)
229
+
230
+ return wrapper
231
+
232
+
233
+ def common_filter_options(f: Callable) -> Callable:
234
+ """
235
+ Common filtering options for resource discovery.
236
+
237
+ Provides:
238
+ - --tags: Filter by tags (key=value format)
239
+ - --accounts: Filter by specific account IDs
240
+
241
+ Usage:
242
+ @common_filter_options
243
+ @click.command()
244
+ def my_command(tags, accounts, **kwargs):
245
+ # Filtering logic
246
+ """
247
+
248
+ @click.option('--tags', type=str, multiple=True,
249
+ help='Filter by tags (key=value format)')
250
+ @click.option('--accounts', type=str, multiple=True,
251
+ help='Filter by specific account IDs')
252
+ @wraps(f)
253
+ def wrapper(*args, **kwargs):
254
+ return f(*args, **kwargs)
255
+
256
+ return wrapper
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: runbooks
3
- Version: 1.1.6
3
+ Version: 1.1.7
4
4
  Summary: CloudOps Automation Toolkit with Enhanced Cloud Foundations Assessment for DevOps and SRE teams.
5
5
  Author-email: Maintainers <nnthanh101@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -1,5 +1,5 @@
1
1
  conftest.py,sha256=HTnQMw9wxefkvX5q4yG8EUH2qVLJBnC9QCt3UCltw7I,586
2
- runbooks/__init__.py,sha256=XIJ23w169HRg3H6-fTWnNQJxPYeEgT0lvBm5BWquER8,6260
2
+ runbooks/__init__.py,sha256=bY1oPPtiOXi-yHA1UJeOr6gwQqcxSZPl0FWSsgNU2qE,6260
3
3
  runbooks/__init__.py.backup,sha256=RN_n1T2it_7bBXlA4dl8GCWAUz8XBpp5FGjGbq8uQaI,4983
4
4
  runbooks/__init___optimized.py,sha256=ao5SdjsJ0T-ZsOFtEqOeEM4hnI8kgIs-8laJZsHEjp0,4011
5
5
  runbooks/__main__.py,sha256=0hTPUA9KkLm_H_COqaIpNzXvC4Lv5b_XYYBV6fUFDrM,241
@@ -84,8 +84,8 @@ runbooks/cfat/tests/test_weight_configuration.ts,sha256=1IfMR0NCvONdprsDv0l24chd
84
84
  runbooks/cli/__init__.py,sha256=9yb8r0P9ipQzaZZPD-NDPeQRtDVWqG7_v_2ru5wPdPU,446
85
85
  runbooks/cli/registry.py,sha256=1hCARcKay2B6atgYSC7X3xGjfXC65_Ep1hJb6buJRJI,3441
86
86
  runbooks/cli/commands/cfat.py,sha256=xL1WG4DmQTOwLL4I8cmnEy5Z82D91iHj0vB7FokTXbg,11041
87
- runbooks/cli/commands/finops.py,sha256=xkfbZgZqfqYJX5l_KMmyTFtxMWvdf6iRYrW9l5N3F4o,55451
88
- runbooks/cli/commands/inventory.py,sha256=68sqYvjES-EzmFvVz9CbEX1TeJDsKJ4ojHmsgW8qGo8,13708
87
+ runbooks/cli/commands/finops.py,sha256=7orBGnTMbnTf_btnBHdtlaeggcQGU3u6c0f-bT6LChQ,56231
88
+ runbooks/cli/commands/inventory.py,sha256=qL3q8Cw4C6vMA9Bx25BQBShsAIIFCKO4zLrDHPRAAQs,14061
89
89
  runbooks/cli/commands/operate.py,sha256=kkSDws1U4SC-5ers6nanBQbsxC6F0xY9--hicr33a3c,10235
90
90
  runbooks/cli/commands/security.py,sha256=Yv3JFqfT4WNulOGtYvhhaxwZtTUOxPwCGDbaCax_KYc,10307
91
91
  runbooks/cli/commands/validation.py,sha256=Vc8y7TcRkrFtdsZZoDkjZ2taS5UuH1e2hSGpRD9Q2_4,38530
@@ -108,7 +108,7 @@ runbooks/common/aws_pricing_api.py,sha256=jTpcGiZHIEBxo2hmrfQtTNNHgWSkPQelQcm-Yy
108
108
  runbooks/common/aws_profile_manager.py,sha256=jJX2FqssFAcmLf6zRaLGShnSJpN1XK07w3nudUmNYXY,11865
109
109
  runbooks/common/aws_utils.py,sha256=voptyeaD7E5W82vW_4yY6M5NICGF3MM7hMz3s00waqM,13190
110
110
  runbooks/common/business_logic.py,sha256=D949mmH_OsMYRTuUcHvcNAaXF35KBB7D6QRQkV5q4A8,20629
111
- runbooks/common/cli_decorators.py,sha256=3RdWVSNyduCLsMweOIFewY6JghqKKr5wuxudJGqVNsw,6302
111
+ runbooks/common/cli_decorators.py,sha256=F8ejBBuD5fDZZStDe0cTjqqGQd4x0WC4Tm-4u6lZh18,8365
112
112
  runbooks/common/comprehensive_cost_explorer_integration.py,sha256=DEIjPW3X4N9B_DCmit3RvGZEgsDtxjDVgQ_eS6TR5ag,43488
113
113
  runbooks/common/context_logger.py,sha256=is72Mvw2QgIp-z9FXNSL-pceDhEsSklH_7QbNmGR6lQ,14757
114
114
  runbooks/common/cross_account_manager.py,sha256=6-b8wfhN4MN8khjBglrqH-LvyzMmrF3VGHpRTJtLZCc,24576
@@ -481,9 +481,9 @@ runbooks/vpc/tests/test_cli_integration.py,sha256=OvsSNd9gFlkzdyDf8tUZGES93TTZR6
481
481
  runbooks/vpc/tests/test_config.py,sha256=GIX7cFnj7xUxxrYX49mV9hYmx60Dcd_Bu-cpb90oXdE,17484
482
482
  runbooks/vpc/tests/test_cost_engine.py,sha256=dR7HTRKDrTduRg5Mr-T7MbP47D67jbKggZ7gyBirfK4,20941
483
483
  runbooks/vpc/tests/test_networking_wrapper.py,sha256=gmxnVzQJ-7rTsghzNLmIM-QZo9GUGyIhHqE1g8gkEkw,20623
484
- runbooks-1.1.6.dist-info/licenses/LICENSE,sha256=WAQUYGIkLJh6CPrlZgr0IsbRODa0EZ6fboBXGjfWggs,11375
485
- runbooks-1.1.6.dist-info/METADATA,sha256=oKpQUak9Mq32RQwKEAtKQH8mrUTjlKNMOag-khDzYp4,12970
486
- runbooks-1.1.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
487
- runbooks-1.1.6.dist-info/entry_points.txt,sha256=WahHUYcgE2syXEc0MkoUdctLMxs0zjBWi_vWb5dRK8M,295
488
- runbooks-1.1.6.dist-info/top_level.txt,sha256=A0zTBjuF7THC6vnJU7StN7ihtUoh31lZSfwyWpWP2YE,18
489
- runbooks-1.1.6.dist-info/RECORD,,
484
+ runbooks-1.1.7.dist-info/licenses/LICENSE,sha256=WAQUYGIkLJh6CPrlZgr0IsbRODa0EZ6fboBXGjfWggs,11375
485
+ runbooks-1.1.7.dist-info/METADATA,sha256=r_S6VEAZfwYo59N_AulPX7l0_BkAyhodAZ80LMvhXPs,12970
486
+ runbooks-1.1.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
487
+ runbooks-1.1.7.dist-info/entry_points.txt,sha256=WahHUYcgE2syXEc0MkoUdctLMxs0zjBWi_vWb5dRK8M,295
488
+ runbooks-1.1.7.dist-info/top_level.txt,sha256=A0zTBjuF7THC6vnJU7StN7ihtUoh31lZSfwyWpWP2YE,18
489
+ runbooks-1.1.7.dist-info/RECORD,,