LifecycleRule Struct
An ECR life cycle rule.
| Source | aws-ecr/lib/lifecycle.ts |
|---|---|
| Type last changed |
Example
declare const repository: ecr.Repository;
repository.addLifecycleRule({ tagPrefixList: ['prod'], maxImageCount: 9999 });
repository.addLifecycleRule({ maxImageAge: Duration.days(30) });
# repository: ecr.Repository
repository.add_lifecycle_rule(tag_prefix_list=["prod"], max_image_count=9999)
repository.add_lifecycle_rule(max_image_age=Duration.days(30))
Repository repository;
repository.addLifecycleRule(LifecycleRule.builder().tagPrefixList(List.of("prod")).maxImageCount(9999).build());
repository.addLifecycleRule(LifecycleRule.builder().maxImageAge(Duration.days(30)).build());
// Install: dotnet add package Amazon.CDK.Lib
Repository repository;
repository.AddLifecycleRule(new LifecycleRule { TagPrefixList = new [] { "prod" }, MaxImageCount = 9999 });
repository.AddLifecycleRule(new LifecycleRule { MaxImageAge = Duration.Days(30) });
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var repository Repository
repository.AddLifecycleRule(&LifecycleRule{
TagPrefixList: []*string{
jsii.String("prod"),
},
MaxImageCount: jsii.Number(9999),
})
repository.AddLifecycleRule(&LifecycleRule{
MaxImageAge: awscdk.Duration_Days(jsii.Number(30)),
})
Properties
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #Default: No description
maxImageAgeoptionalDurationmax_image_ageoptionalDurationmaxImageAgeoptionalDurationMaxImageAgeoptionalDurationMaxImageAgeoptionalDuration #Specify exactly one of maxImageCount and maxImageAge.
maxImageCountoptionalnumbermax_image_countoptionalint | floatmaxImageCountoptionalNumberMaxImageCountoptionaldoubleMaxImageCountoptional*float64 #Specify exactly one of maxImageCount and maxImageAge.
rulePriorityoptionalnumberrule_priorityoptionalint | floatrulePriorityoptionalNumberRulePriorityoptionaldoubleRulePriorityoptional*float64 #Default: Automatically assigned
notes
All rules must have a unique priority, where lower numbers have higher precedence. The first rule that matches is applied to an image.
There can only be one rule with a tagStatus of Any, and it must have the highest rulePriority.
All rules without a specified priority will have incrementing priorities automatically assigned to them, higher than any rules that DO have priorities.
tagPatternListoptionalstring[]tag_pattern_listoptionaltyping.List[str]tagPatternListoptionalList<String>TagPatternListoptionalstring[]TagPatternListoptional*[]*string #notes
There is a maximum limit of four wildcards () per string. For example, ["test123", "test123*"] is valid but ["test123456"] is invalid.
Both tagPrefixList and tagPatternList cannot be specified together in a rule.
Only if tagStatus == TagStatus.Tagged
tagPrefixListoptionalstring[]tag_prefix_listoptionaltyping.List[str]tagPrefixListoptionalList<String>TagPrefixListoptionalstring[]TagPrefixListoptional*[]*string #Both tagPrefixList and tagPatternList cannot be specified together in a rule.
Only if tagStatus == TagStatus.Tagged
tagStatusoptionalTagStatustag_statusoptionalTagStatustagStatusoptionalTagStatusTagStatusoptionalTagStatusTagStatusoptionalTagStatus #Default: TagStatus.Tagged if tagPrefixList or tagPatternList is given, TagStatus.Any otherwise
Only one rule is allowed to select untagged images, and it must have the highest rulePriority.