cdk-factory 0.15.11__tar.gz → 0.15.12__tar.gz
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.
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/PKG-INFO +1 -1
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/pyproject.toml +1 -1
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/rds.py +96 -4
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/pipeline/pipeline_factory.py +1 -0
- cdk_factory-0.15.12/src/cdk_factory/stack/stack_factory.py +88 -0
- cdk_factory-0.15.12/src/cdk_factory/version.py +1 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/workload/workload_factory.py +1 -0
- cdk_factory-0.15.11/src/cdk_factory/stack/stack_factory.py +0 -54
- cdk_factory-0.15.11/src/cdk_factory/version.py +0 -1
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/.gitignore +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/.windsurfrules +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/LICENSE +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/README.md +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/archive/README.md +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/archive/migrate_to_enhanced_ssm.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/examples/json-imports/README.md +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/examples/separate-api-gateway/README.md +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/examples/separate-api-gateway/api-gateway-stack.json +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/examples/separate-api-gateway/config.json +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/examples/separate-api-gateway/lambda-stack.json +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/mypy.ini +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/publish_to_pypi.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/publish_to_pypi.sh +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/pysetup.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/pysetup.sh +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/requirements.dev.txt +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/requirements.tests.txt +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/requirements.txt +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/run-checks.sh +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/run-tests-clean-venv.sh +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/run-tests.sh +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/scripts/cloudfront-cleanup.sh +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/__init__.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/app.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/builds/README.md +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/cdk.json +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/cli.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/commands/command_loader.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/base_config.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/cdk_config.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/deployment.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/deployment_wave.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/devops.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/enhanced_base_config.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/enhanced_ssm_config.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/management.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/pipeline.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/pipeline_stage.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/_resources.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/api_gateway.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/apigateway_route_config.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/auto_scaling.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/cloudfront.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/cloudwatch_widget.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/code_artifact.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/code_artifact_login.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/code_repository.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/cognito.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/docker.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/dynamodb.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/ecr.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/ecs_service.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/exisiting.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/lambda_edge.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/lambda_function.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/lambda_layers.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/lambda_triggers.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/load_balancer.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/monitoring.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/resource_mapping.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/resource_naming.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/resource_types.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/route53.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/route53_hosted_zone.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/rum.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/s3.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/security_group.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/security_group_full_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/sqs.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/vpc.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/workload.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/constructs/cloudfront/cloudfront_distribution_construct.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/constructs/ecr/ecr_construct.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/constructs/lambdas/lambda_function_construct.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/constructs/lambdas/lambda_function_docker_construct.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/constructs/lambdas/lambda_function_role_construct.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/constructs/lambdas/policies/policy_docs.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/constructs/lambdas/policies/policy_statements.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/constructs/s3_buckets/s3_bucket_construct.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/constructs/s3_buckets/s3_bucket_replication_destination_construct.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/constructs/s3_buckets/s3_bucket_replication_source_construct.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/constructs/sqs/policies/sqs_policies.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/interfaces/enhanced_ssm_parameter_mixin.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/interfaces/istack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/interfaces/live_ssm_resolver.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/interfaces/ssm_parameter_mixin.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/lambdas/edge/ip_gate/handler.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/lambdas/health_handler.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/pipeline/path_utils.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/pipeline/security/policies.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/pipeline/security/roles.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/pipeline/stage.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack/istack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack/stack_module_loader.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack/stack_module_registry.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack/stack_modules.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/__init__.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/api_gateway/api_gateway_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/auto_scaling/__init__.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/auto_scaling/auto_scaling_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/aws_lambdas/lambda_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/buckets/README.md +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/buckets/bucket_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/cloudfront/__init__.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/cloudfront/cloudfront_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/code_artifact/code_artifact_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/cognito/cognito_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/dynamodb/dynamodb_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/ecr/README.md +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/ecr/ecr_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/ecs/__init__.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/ecs/ecs_service_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/lambda_edge/__init__.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/lambda_edge/lambda_edge_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/load_balancer/__init__.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/load_balancer/load_balancer_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/monitoring/__init__.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/monitoring/monitoring_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/rds/__init__.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/rds/rds_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/route53/__init__.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/route53/route53_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/rum/__init__.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/rum/rum_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/security_group/__init__.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/security_group/security_group_full_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/security_group/security_group_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/simple_queue_service/sqs_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/stack_base.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/vpc/__init__.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/vpc/vpc_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/websites/static_website_stack.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stages/websites/static_website_stage.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/templates/README.md +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/templates/app.py.template +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/templates/cdk.json.template +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utilities/api_gateway_integration_utility.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utilities/commandline_args.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utilities/configuration_loader.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utilities/docker_utilities.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utilities/environment_services.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utilities/file_operations.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utilities/git_utilities.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utilities/json_loading_utility.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utilities/lambda_function_utilities.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utilities/os_execute.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utils/api_gateway_utilities.py +0 -0
- {cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/handlers/test/handler.py +0 -0
|
@@ -4,9 +4,13 @@ Maintainers: Eric Wilson
|
|
|
4
4
|
MIT License. See Project Root for license information.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
+
import re
|
|
7
8
|
from typing import Any, Dict, List, Optional
|
|
9
|
+
from aws_lambda_powertools import Logger
|
|
8
10
|
from cdk_factory.configurations.enhanced_base_config import EnhancedBaseConfig
|
|
9
11
|
|
|
12
|
+
logger = Logger(service="RdsConfig")
|
|
13
|
+
|
|
10
14
|
|
|
11
15
|
class RdsConfig(EnhancedBaseConfig):
|
|
12
16
|
"""
|
|
@@ -44,13 +48,15 @@ class RdsConfig(EnhancedBaseConfig):
|
|
|
44
48
|
|
|
45
49
|
@property
|
|
46
50
|
def database_name(self) -> str:
|
|
47
|
-
"""Name of the database to create"""
|
|
48
|
-
|
|
51
|
+
"""Name of the database to create (sanitized for RDS requirements)"""
|
|
52
|
+
raw_name = self.__config.get("database_name", "appdb")
|
|
53
|
+
return self._sanitize_database_name(raw_name)
|
|
49
54
|
|
|
50
55
|
@property
|
|
51
56
|
def username(self) -> str:
|
|
52
|
-
"""Master username for the database"""
|
|
53
|
-
|
|
57
|
+
"""Master username for the database (sanitized for RDS requirements)"""
|
|
58
|
+
raw_username = self.__config.get("username", "appuser")
|
|
59
|
+
return self._sanitize_username(raw_username)
|
|
54
60
|
|
|
55
61
|
@property
|
|
56
62
|
def secret_name(self) -> str:
|
|
@@ -146,3 +152,89 @@ class RdsConfig(EnhancedBaseConfig):
|
|
|
146
152
|
if "ssm" in self.__config and "exports" in self.__config["ssm"]:
|
|
147
153
|
return self.__config["ssm"]["exports"]
|
|
148
154
|
return self.__config.get("ssm_exports", {})
|
|
155
|
+
|
|
156
|
+
def _sanitize_database_name(self, name: str) -> str:
|
|
157
|
+
"""
|
|
158
|
+
Sanitize database name to meet RDS requirements:
|
|
159
|
+
- Must begin with a letter (a-z, A-Z)
|
|
160
|
+
- Can contain alphanumeric characters and underscores
|
|
161
|
+
- Max 64 characters
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
name: Raw database name from config
|
|
165
|
+
|
|
166
|
+
Returns:
|
|
167
|
+
Sanitized database name
|
|
168
|
+
|
|
169
|
+
Raises:
|
|
170
|
+
ValueError: If name starts with a number or is empty after sanitization
|
|
171
|
+
"""
|
|
172
|
+
if not name:
|
|
173
|
+
raise ValueError("Database name cannot be empty")
|
|
174
|
+
|
|
175
|
+
# Replace hyphens with underscores, remove other invalid chars
|
|
176
|
+
sanitized = name.replace('-', '_')
|
|
177
|
+
sanitized = re.sub(r'[^a-zA-Z0-9_]', '', sanitized)
|
|
178
|
+
|
|
179
|
+
if not sanitized:
|
|
180
|
+
raise ValueError(f"Database name '{name}' contains no valid characters")
|
|
181
|
+
|
|
182
|
+
# Check if it starts with a number
|
|
183
|
+
if sanitized[0].isdigit():
|
|
184
|
+
raise ValueError(
|
|
185
|
+
f"Database name '{name}' (sanitized to '{sanitized}') cannot start with a number. "
|
|
186
|
+
f"Please ensure the database name begins with a letter."
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
# Truncate to 64 characters if needed
|
|
190
|
+
if len(sanitized) > 64:
|
|
191
|
+
sanitized = sanitized[:64]
|
|
192
|
+
|
|
193
|
+
# Log if sanitization changed the name
|
|
194
|
+
if sanitized != name:
|
|
195
|
+
logger.info(f"Sanitized database name from '{name}' to '{sanitized}'")
|
|
196
|
+
|
|
197
|
+
return sanitized
|
|
198
|
+
|
|
199
|
+
def _sanitize_username(self, username: str) -> str:
|
|
200
|
+
"""
|
|
201
|
+
Sanitize username to meet RDS requirements:
|
|
202
|
+
- Must begin with a letter (a-z, A-Z)
|
|
203
|
+
- Can contain alphanumeric characters and underscores
|
|
204
|
+
- Max 16 characters for MySQL
|
|
205
|
+
|
|
206
|
+
Args:
|
|
207
|
+
username: Raw username from config
|
|
208
|
+
|
|
209
|
+
Returns:
|
|
210
|
+
Sanitized username
|
|
211
|
+
|
|
212
|
+
Raises:
|
|
213
|
+
ValueError: If username is invalid
|
|
214
|
+
"""
|
|
215
|
+
if not username:
|
|
216
|
+
raise ValueError("Username cannot be empty")
|
|
217
|
+
|
|
218
|
+
# Replace hyphens with underscores, remove other invalid chars
|
|
219
|
+
sanitized = username.replace('-', '_')
|
|
220
|
+
sanitized = re.sub(r'[^a-zA-Z0-9_]', '', sanitized)
|
|
221
|
+
|
|
222
|
+
if not sanitized:
|
|
223
|
+
raise ValueError(f"Username '{username}' contains no valid characters")
|
|
224
|
+
|
|
225
|
+
# Check if it starts with a number
|
|
226
|
+
if sanitized[0].isdigit():
|
|
227
|
+
raise ValueError(
|
|
228
|
+
f"Username '{username}' (sanitized to '{sanitized}') cannot start with a number. "
|
|
229
|
+
f"Please ensure the username begins with a letter."
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
# Truncate to 16 characters for MySQL (other engines may vary)
|
|
233
|
+
if len(sanitized) > 16:
|
|
234
|
+
sanitized = sanitized[:16]
|
|
235
|
+
|
|
236
|
+
# Log if sanitization changed the username
|
|
237
|
+
if sanitized != username:
|
|
238
|
+
logger.info(f"Sanitized username from '{username}' to '{sanitized}'")
|
|
239
|
+
|
|
240
|
+
return sanitized
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Geek Cafe, LLC
|
|
3
|
+
Maintainers: Eric Wilson
|
|
4
|
+
MIT License. See Project Root for the license information.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Type, Dict, Any, Optional
|
|
8
|
+
|
|
9
|
+
from aws_cdk import Environment
|
|
10
|
+
from cdk_factory.interfaces.istack import IStack
|
|
11
|
+
from cdk_factory.stack.stack_module_loader import ModuleLoader
|
|
12
|
+
from cdk_factory.stack.stack_module_registry import modules
|
|
13
|
+
from cdk_factory.configurations.deployment import DeploymentConfig
|
|
14
|
+
from cdk_factory.configurations.stack import StackConfig
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class StackFactory:
|
|
18
|
+
"""Stack Factory"""
|
|
19
|
+
|
|
20
|
+
# Default descriptions by module type
|
|
21
|
+
DEFAULT_DESCRIPTIONS = {
|
|
22
|
+
"vpc_stack": "VPC infrastructure with public and private subnets across multiple availability zones",
|
|
23
|
+
"security_group_stack": "Security groups for network access control",
|
|
24
|
+
"security_group_full_stack": "Security groups for ALB, ECS, RDS, and monitoring",
|
|
25
|
+
"rds_stack": "Managed relational database instance with automated backups",
|
|
26
|
+
"s3_bucket_stack": "S3 bucket for object storage",
|
|
27
|
+
"media_bucket_stack": "S3 bucket for media asset storage with CDN integration",
|
|
28
|
+
"static_website_stack": "Static website hosted on S3 with CloudFront distribution",
|
|
29
|
+
"ecs_service_stack": "ECS service with auto-scaling and load balancing",
|
|
30
|
+
"lambda_stack": "Lambda function for serverless compute",
|
|
31
|
+
"api_gateway_stack": "API Gateway for REST API endpoints",
|
|
32
|
+
"cloudfront_stack": "CloudFront CDN distribution",
|
|
33
|
+
"monitoring_stack": "CloudWatch monitoring, alarms, and dashboards",
|
|
34
|
+
"ecr_stack": "Elastic Container Registry for Docker images",
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
def __init__(self):
|
|
38
|
+
ml: ModuleLoader = ModuleLoader()
|
|
39
|
+
|
|
40
|
+
ml.load_known_modules()
|
|
41
|
+
|
|
42
|
+
def load_module(
|
|
43
|
+
self,
|
|
44
|
+
module_name: str,
|
|
45
|
+
scope,
|
|
46
|
+
id: str, # pylint: disable=redefined-builtin
|
|
47
|
+
deployment: Optional[DeploymentConfig] = None,
|
|
48
|
+
stack_config: Optional[StackConfig] = None,
|
|
49
|
+
add_env_context: bool = True,
|
|
50
|
+
**kwargs,
|
|
51
|
+
) -> IStack:
|
|
52
|
+
"""Loads a particular module"""
|
|
53
|
+
# print(f"loading module: {module_name}")
|
|
54
|
+
stack_class: Type[IStack] = modules.get(module_name)
|
|
55
|
+
if not stack_class:
|
|
56
|
+
raise ValueError(f"Failed to load module: {module_name}")
|
|
57
|
+
|
|
58
|
+
# Add environment information if deployment is provided and add_env_context is True
|
|
59
|
+
if deployment and add_env_context:
|
|
60
|
+
env_kwargs = self._get_environment_kwargs(deployment)
|
|
61
|
+
kwargs.update(env_kwargs)
|
|
62
|
+
|
|
63
|
+
# Add description if not already provided in kwargs
|
|
64
|
+
if "description" not in kwargs:
|
|
65
|
+
description = self._get_stack_description(module_name, stack_config)
|
|
66
|
+
if description:
|
|
67
|
+
kwargs["description"] = description
|
|
68
|
+
|
|
69
|
+
module = stack_class(scope=scope, id=id, **kwargs)
|
|
70
|
+
|
|
71
|
+
return module
|
|
72
|
+
|
|
73
|
+
def _get_environment_kwargs(self, deployment: DeploymentConfig) -> Dict[str, Any]:
|
|
74
|
+
"""Get environment kwargs from deployment config"""
|
|
75
|
+
env = Environment(
|
|
76
|
+
account=deployment.account,
|
|
77
|
+
region=deployment.region
|
|
78
|
+
)
|
|
79
|
+
return {"env": env}
|
|
80
|
+
|
|
81
|
+
def _get_stack_description(self, module_name: str, stack_config: Optional[StackConfig] = None) -> Optional[str]:
|
|
82
|
+
"""Get stack description from config or default"""
|
|
83
|
+
# First check if stack_config has a description
|
|
84
|
+
if stack_config and stack_config.description:
|
|
85
|
+
return stack_config.description
|
|
86
|
+
|
|
87
|
+
# Otherwise use default description based on module type
|
|
88
|
+
return self.DEFAULT_DESCRIPTIONS.get(module_name)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.15.12"
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Geek Cafe, LLC
|
|
3
|
-
Maintainers: Eric Wilson
|
|
4
|
-
MIT License. See Project Root for the license information.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from typing import Type, Dict, Any, Optional
|
|
8
|
-
|
|
9
|
-
from aws_cdk import Environment
|
|
10
|
-
from cdk_factory.interfaces.istack import IStack
|
|
11
|
-
from cdk_factory.stack.stack_module_loader import ModuleLoader
|
|
12
|
-
from cdk_factory.stack.stack_module_registry import modules
|
|
13
|
-
from cdk_factory.configurations.deployment import DeploymentConfig
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class StackFactory:
|
|
17
|
-
"""Stack Factory"""
|
|
18
|
-
|
|
19
|
-
def __init__(self):
|
|
20
|
-
ml: ModuleLoader = ModuleLoader()
|
|
21
|
-
|
|
22
|
-
ml.load_known_modules()
|
|
23
|
-
|
|
24
|
-
def load_module(
|
|
25
|
-
self,
|
|
26
|
-
module_name: str,
|
|
27
|
-
scope,
|
|
28
|
-
id: str, # pylint: disable=redefined-builtin
|
|
29
|
-
deployment: Optional[DeploymentConfig] = None,
|
|
30
|
-
add_env_context: bool = True,
|
|
31
|
-
**kwargs,
|
|
32
|
-
) -> IStack:
|
|
33
|
-
"""Loads a particular module"""
|
|
34
|
-
# print(f"loading module: {module_name}")
|
|
35
|
-
stack_class: Type[IStack] = modules.get(module_name)
|
|
36
|
-
if not stack_class:
|
|
37
|
-
raise ValueError(f"Failed to load module: {module_name}")
|
|
38
|
-
|
|
39
|
-
# Add environment information if deployment is provided and add_env_context is True
|
|
40
|
-
if deployment and add_env_context:
|
|
41
|
-
env_kwargs = self._get_environment_kwargs(deployment)
|
|
42
|
-
kwargs.update(env_kwargs)
|
|
43
|
-
|
|
44
|
-
module = stack_class(scope=scope, id=id, **kwargs)
|
|
45
|
-
|
|
46
|
-
return module
|
|
47
|
-
|
|
48
|
-
def _get_environment_kwargs(self, deployment: DeploymentConfig) -> Dict[str, Any]:
|
|
49
|
-
"""Get environment kwargs from deployment config"""
|
|
50
|
-
env = Environment(
|
|
51
|
-
account=deployment.account,
|
|
52
|
-
region=deployment.region
|
|
53
|
-
)
|
|
54
|
-
return {"env": env}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.15.11"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/examples/separate-api-gateway/api-gateway-stack.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/deployment_wave.py
RENAMED
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/enhanced_base_config.py
RENAMED
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/enhanced_ssm_config.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/pipeline_stage.py
RENAMED
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/_resources.py
RENAMED
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/api_gateway.py
RENAMED
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/auto_scaling.py
RENAMED
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/cloudfront.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/cognito.py
RENAMED
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/docker.py
RENAMED
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/dynamodb.py
RENAMED
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/ecs_service.py
RENAMED
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/exisiting.py
RENAMED
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/lambda_edge.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/monitoring.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/configurations/resources/route53.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/constructs/sqs/policies/sqs_policies.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/interfaces/ssm_parameter_mixin.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/auto_scaling/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/buckets/bucket_stack.py
RENAMED
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/cloudfront/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/cognito/cognito_stack.py
RENAMED
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/dynamodb/dynamodb_stack.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/ecs/ecs_service_stack.py
RENAMED
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/lambda_edge/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/load_balancer/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/monitoring/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/route53/__init__.py
RENAMED
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/route53/route53_stack.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stack_library/security_group/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/stages/websites/static_website_stage.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utilities/configuration_loader.py
RENAMED
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utilities/environment_services.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utilities/json_loading_utility.py
RENAMED
|
File without changes
|
{cdk_factory-0.15.11 → cdk_factory-0.15.12}/src/cdk_factory/utilities/lambda_function_utilities.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|