cdk-factory 0.8.2__py3-none-any.whl → 0.8.3__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.

Potentially problematic release.


This version of cdk-factory might be problematic. Click here for more details.

@@ -436,12 +436,16 @@ class ApiGatewayStack(IStack, EnhancedSsmParameterMixin):
436
436
  return None
437
437
 
438
438
  def _setup_single_lambda_route(self, api_gateway, api_id, route, authorizer):
439
- """
440
- Setup a single Lambda route with integration and CORS.
441
- LEGACY PATTERN: Creates a new Lambda function inline.
442
- Prefer _setup_existing_lambda_route for new implementations.
443
- """
444
- suffix = route["path"].strip("/").replace("/", "-") or "health"
439
+ """Setup a single Lambda route with integration and CORS"""
440
+ # Use the 'name' field if provided, otherwise include method in suffix for uniqueness
441
+ if "name" in route and route["name"]:
442
+ suffix = route["name"] # Use the unique name provided in config
443
+ else:
444
+ # Include method to ensure uniqueness when same path has multiple methods
445
+ method = route.get("method", "GET").upper()
446
+ path_suffix = route["path"].strip("/").replace("/", "-") or "health"
447
+ suffix = f"{method.lower()}-{path_suffix}"
448
+
445
449
  src = route.get("src")
446
450
  handler = route.get("handler")
447
451
 
@@ -14,16 +14,30 @@ class JsonLoadingUtility:
14
14
  """
15
15
  JSON Loading Utility
16
16
  This class is used to load a JSON file. We have a special syntax that allows
17
- chaining JSON files together using __inherits__
17
+ chaining JSON files together using __imports__ or __inherits__ (legacy).
18
+
19
+ The __imports__ keyword allows you to:
20
+ - Import from external JSON files: "__imports__": "./base-config.json"
21
+ - Import from nested sections: "__imports__": "workload.defaults"
22
+ - Import from directories: "__imports__": "./configs/"
23
+ - Import multiple sources: "__imports__": ["base.json", "overrides.json"]
18
24
 
19
25
  Examples:
20
- TODO - show some examples
26
+ # Single file import
27
+ {"__imports__": "./base-config.json", "name": "override"}
28
+
29
+ # Multiple imports (merged in order)
30
+ {"__imports__": ["base.json", "env-specific.json"]}
31
+
32
+ # Nested section reference
33
+ {"__imports__": "workload.defaults.lambda"}
21
34
  """
22
35
 
23
36
  def __init__(self, path) -> None:
24
37
  self.path = path
25
38
  self.base_path = os.path.dirname(path)
26
- self.nested_key = "__inherits__"
39
+ # Support both __imports__ (preferred) and __inherits__ (legacy)
40
+ self.import_keys = ["__imports__", "__inherits__"]
27
41
 
28
42
  def load(self):
29
43
  """Load and parse the JSON object for nested resources."""
@@ -60,14 +74,24 @@ class JsonLoadingUtility:
60
74
  ):
61
75
  """Resolve references in a configuration section."""
62
76
  if isinstance(section, dict):
63
- if self.nested_key in section:
64
- nested_paths = section.pop(self.nested_key)
77
+ # Check for import keys (try __imports__ first, fall back to __inherits__)
78
+ import_key = None
79
+ for key in self.import_keys:
80
+ if key in section:
81
+ import_key = key
82
+ break
83
+
84
+ if import_key:
85
+ nested_paths = section.pop(import_key)
65
86
 
66
87
  # Support both single path (string) and multiple paths (list)
67
88
  if isinstance(nested_paths, str):
68
89
  nested_paths = [nested_paths]
69
90
  elif not isinstance(nested_paths, list):
70
- raise ValueError(f"__inherits__ must be a string or list, got {type(nested_paths)}")
91
+ raise ValueError(
92
+ f"{import_key} must be a string or list of paths, got {type(nested_paths)}. "
93
+ f"Example: '{import_key}': './base.json' or '{import_key}': ['base.json', 'overrides.json']"
94
+ )
71
95
 
72
96
  # Process each path and merge results
73
97
  merged_section = None
cdk_factory/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.8.2"
1
+ __version__ = "0.8.3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cdk_factory
3
- Version: 0.8.2
3
+ Version: 0.8.3
4
4
  Summary: CDK Factory. A QuickStarter and best practices setup for CDK projects
5
5
  Author-email: Eric Wilson <eric.wilson@geekcafe.com>
6
6
  License: MIT License
@@ -1,7 +1,7 @@
1
1
  cdk_factory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  cdk_factory/app.py,sha256=xv863N7O6HPKznB68_t7O4la9JacrkG87t9TjoDUk7s,2827
3
3
  cdk_factory/cdk.json,sha256=SKZKhJ2PBpFH78j-F8S3VDYW-lf76--Q2I3ON-ZIQfw,3106
4
- cdk_factory/version.py,sha256=B7GiO0rd49YwtLYjvPg4lmCZEDlMTonslQKdSImaMJk,22
4
+ cdk_factory/version.py,sha256=otnwfmvJLUamPajTPUaIekiO9mA-2HPi-_h_E0N-uOQ,22
5
5
  cdk_factory/builds/README.md,sha256=9BBWd7bXpyKdMU_g2UljhQwrC9i5O_Tvkb6oPvndoZk,90
6
6
  cdk_factory/commands/command_loader.py,sha256=QbLquuP_AdxtlxlDy-2IWCQ6D-7qa58aphnDPtp_uTs,3744
7
7
  cdk_factory/configurations/base_config.py,sha256=JKjhNsy0RCUZy1s8n5D_aXXI-upR9izaLtCTfKYiV9k,9624
@@ -73,7 +73,7 @@ cdk_factory/stack/stack_module_registry.py,sha256=J14-A75VZESzRQa8p-Fepdap7Z8T7m
73
73
  cdk_factory/stack/stack_modules.py,sha256=kgEK-j0smZPozVwTCfM1g1V17EyTBT0TXAQZq4vZz0o,784
74
74
  cdk_factory/stack_library/__init__.py,sha256=5Y9TpIe8ZK1688G60PGcuP-hM0RvYEY_3Hl2qJCJJrw,581
75
75
  cdk_factory/stack_library/stack_base.py,sha256=tTleSFmlf26DuKVF_ytftf8P7IVWb5iex8cYfYupfvQ,4940
76
- cdk_factory/stack_library/api_gateway/api_gateway_stack.py,sha256=5rWHwLc6kI99YHUA1xqLtzcEhDmMB4p-xB9gLQ6o8JE,37916
76
+ cdk_factory/stack_library/api_gateway/api_gateway_stack.py,sha256=AdC_TTAgdOIagahEuMZcA208E6osjO1lK80I6E1k5cc,38212
77
77
  cdk_factory/stack_library/auto_scaling/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
78
78
  cdk_factory/stack_library/auto_scaling/auto_scaling_stack.py,sha256=UsFqUb_3XPJAlmZ6F75nXna3elOggD1KuFmmdmhi0Lg,19070
79
79
  cdk_factory/stack_library/aws_lambdas/lambda_stack.py,sha256=SFbBPvvCopbyiuYtq-O5sQkFCf94Wzua6aDUXiFDSB4,26161
@@ -107,12 +107,12 @@ cdk_factory/utilities/docker_utilities.py,sha256=9r8C-lXYpymqEfi3gTeWCQzHldvfjtt
107
107
  cdk_factory/utilities/environment_services.py,sha256=cd2T0efJtFPMLa1Fm7MPL-sqUlhKXCB7_XHsR8sfymE,9696
108
108
  cdk_factory/utilities/file_operations.py,sha256=HCZevKlmnHNB2wkIEPtdm-g2nJSKT3B9uipLk8Kx_Yk,8946
109
109
  cdk_factory/utilities/git_utilities.py,sha256=7Xac8PaThc7Lmk5jtDBHaJOj-fWRT017cgZmgXkVizM,3155
110
- cdk_factory/utilities/json_loading_utility.py,sha256=Yeqdjkkly0JLa7-V8j7ipmybsPoyPIKdRe7My7JTk3o,9203
110
+ cdk_factory/utilities/json_loading_utility.py,sha256=YRgzA1I-B_HwZm1eWJTeQ1JLkebCL4C1gpHOqo6GkCA,10341
111
111
  cdk_factory/utilities/lambda_function_utilities.py,sha256=j3tBdv_gC2MdEwBINDwAqYey5vgn7YiQtJ0XZybTsCQ,15197
112
112
  cdk_factory/utilities/os_execute.py,sha256=5Op0LY_8Y-pUm04y1k8MTpNrmQvcLmQHPQITEP7EuSU,1019
113
113
  cdk_factory/utils/api_gateway_utilities.py,sha256=If7Xu5s_UxmuV-kL3JkXxPLBdSVUKoLtohm0IUFoiV8,4378
114
114
  cdk_factory/workload/workload_factory.py,sha256=yBUDGIuB8-5p_mGcVFxsD2ZoZIziak3yh3LL3JvS0M4,5903
115
- cdk_factory-0.8.2.dist-info/METADATA,sha256=PbYIaV_hrIj-7YZxLTQvR-GdLk6WErUYjuYP99HsjHA,2450
116
- cdk_factory-0.8.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
117
- cdk_factory-0.8.2.dist-info/licenses/LICENSE,sha256=NOtdOeLwg2il_XBJdXUPFPX8JlV4dqTdDGAd2-khxT8,1066
118
- cdk_factory-0.8.2.dist-info/RECORD,,
115
+ cdk_factory-0.8.3.dist-info/METADATA,sha256=yE-OmEZQq02UmCyeqJXEL3H3nkMU3qVba2GuHqDWfqo,2450
116
+ cdk_factory-0.8.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
117
+ cdk_factory-0.8.3.dist-info/licenses/LICENSE,sha256=NOtdOeLwg2il_XBJdXUPFPX8JlV4dqTdDGAd2-khxT8,1066
118
+ cdk_factory-0.8.3.dist-info/RECORD,,