Class LifecycleRule
An ECR life cycle rule.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.ECR
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class LifecycleRule : Object, ILifecycleRule
Syntax (vb)
Public Class LifecycleRule
Inherits Object
Implements ILifecycleRule
Remarks
ExampleMetadata: infused
Examples
Repository repository;
repository.AddLifecycleRule(new LifecycleRule { TagPrefixList = new [] { "prod" }, MaxImageCount = 9999 });
repository.AddLifecycleRule(new LifecycleRule { MaxImageAge = Duration.Days(30) });
Synopsis
Constructors
LifecycleRule() |
Properties
Description | Describes the purpose of the rule. |
MaxImageAge | The maximum age of images to retain. The value must represent a number of days. |
MaxImageCount | The maximum number of images to retain. |
RulePriority | Controls the order in which rules are evaluated (low to high). |
TagPatternList | Select images that have ALL the given patterns in their tag. |
TagPrefixList | Select images that have ALL the given prefixes in their tag. |
TagStatus | Select images based on tags. |
Constructors
LifecycleRule()
public LifecycleRule()
Properties
Description
Describes the purpose of the rule.
public string Description { get; set; }
Property Value
System.String
Remarks
Default: No description
MaxImageAge
The maximum age of images to retain. The value must represent a number of days.
public Duration MaxImageAge { get; set; }
Property Value
Remarks
Specify exactly one of maxImageCount and maxImageAge.
MaxImageCount
The maximum number of images to retain.
public Nullable<double> MaxImageCount { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Specify exactly one of maxImageCount and maxImageAge.
RulePriority
Controls the order in which rules are evaluated (low to high).
public Nullable<double> RulePriority { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
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.
Default: Automatically assigned
TagPatternList
Select images that have ALL the given patterns in their tag.
public string[] TagPatternList { get; set; }
Property Value
System.String[]
Remarks
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
TagPrefixList
Select images that have ALL the given prefixes in their tag.
public string[] TagPrefixList { get; set; }
Property Value
System.String[]
Remarks
Both tagPrefixList and tagPatternList cannot be specified together in a rule.
Only if tagStatus == TagStatus.Tagged
TagStatus
Select images based on tags.
public Nullable<TagStatus> TagStatus { get; set; }
Property Value
System.Nullable<TagStatus>
Remarks
Only one rule is allowed to select untagged images, and it must have the highest rulePriority.
Default: TagStatus.Tagged if tagPrefixList or tagPatternList is given, TagStatus.Any otherwise