params¶
Parameter Management System for AWS CDK
This module provides a type-safe, extendable parameter system for AWS CDK constructs and stacks using Python dataclasses. The motivation for this system is to address limitations when subclassing CDK constructs like cdk.Stack:
- Because cdk Python uses
def __init__(self, ...):, subclassing requires repeating parameter definitions to maintain type hints
- Because cdk Python uses
Using
**kwargsloses type information and IDE completion supportValidation of required parameters is handled manually and inconsistently
- class cdkit.params.ConstructParams(id: str = REQ)[source]¶
Parameter dataclass for CDK Construct initialization.
How to extend:
import dataclasses from func_args.api import REQ @dataclasses.dataclass class MyConstructParams(ConstructParams): your_custom_param_1: int = dataclasses.field(default=REQ) your_custom_param_2: str = dataclasses.field(default="my_default_value")
- class cdkit.params.StackParams(id: str = REQ, analytics_reporting: bool = OPT, cross_region_references: bool = OPT, description: str = OPT, env: cdk.Environment | dict[str, Any] = OPT, notification_arns: Sequence[str] = OPT, permissions_boundary: cdk.PermissionsBoundary = OPT, stack_name: str = OPT, suppress_template_indentation: bool = OPT, synthesizer: cdk.IStackSynthesizer = OPT, tags: Mapping[str, str] = OPT, termination_protection: bool = OPT)[source]¶
Parameter dataclass for CDK Stack initialization.
How to extend:
import dataclasses from func_args.api import REQ @dataclasses.dataclass class MyStackParams(StackParams): your_custom_param_1: int = dataclasses.field(default=REQ) your_custom_param_2: str = dataclasses.field(default="my_default_value")