EcrConfig¶
Bases: BaseModel, NameValidationMixin
Configuration model for AWS ECR repository creation.
Defines the structure and validation rules for creating ECR repositories, with support for KMS encryption, image retention policies, and cross-account sharing.
Attributes:
| Name | Type | Description |
|---|---|---|
use_kms_key |
bool
|
Enable KMS encryption for container image security |
images_retained |
Optional[int]
|
Maximum number of images to keep with automatic cleanup |
shareable_with_all_envs |
bool
|
Enable cross-account repository access patterns |
ecr_repo_base_name |
str
|
Base identifier for the repository following naming conventions |
Source code in mare_aws_common_lib/models/ecr_config.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
validate_ecr_repo_name(value)
classmethod
¶
Validate the ECR repo base name.
Applies validation rules to ecr repo naming to ensure the name meets AWS requirements and organizational standards.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
Raw ecr repo base name from configuration |
required |
Returns:
| Type | Description |
|---|---|
str
|
Validated ecr repo base name |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the ecr repo name fails validation rules |
Source code in mare_aws_common_lib/models/ecr_config.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
Example
from mare_aws_common_lib.models import EcrConfig
config = EcrConfig(
ecr_repo_base_name="my-ecr",
use_kms_key=True,
images_retained=20,
shareable_with_all_envs=True
)