Class LifecycleRule.Builder
java.lang.Object
software.amazon.awscdk.services.ecr.LifecycleRule.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<LifecycleRule>
- Enclosing interface:
LifecycleRule
@Stability(Stable)
public static final class LifecycleRule.Builder
extends Object
implements software.amazon.jsii.Builder<LifecycleRule>
A builder for
LifecycleRule
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the configured instance.description
(String description) Sets the value ofLifecycleRule.getDescription()
maxImageAge
(Duration maxImageAge) Sets the value ofLifecycleRule.getMaxImageAge()
maxImageCount
(Number maxImageCount) Sets the value ofLifecycleRule.getMaxImageCount()
rulePriority
(Number rulePriority) Sets the value ofLifecycleRule.getRulePriority()
tagPatternList
(List<String> tagPatternList) Sets the value ofLifecycleRule.getTagPatternList()
tagPrefixList
(List<String> tagPrefixList) Sets the value ofLifecycleRule.getTagPrefixList()
Sets the value ofLifecycleRule.getTagStatus()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
description
Sets the value ofLifecycleRule.getDescription()
- Parameters:
description
- Describes the purpose of the rule.- Returns:
this
-
maxImageAge
Sets the value ofLifecycleRule.getMaxImageAge()
- Parameters:
maxImageAge
- The maximum age of images to retain. The value must represent a number of days. Specify exactly one of maxImageCount and maxImageAge.- Returns:
this
-
maxImageCount
Sets the value ofLifecycleRule.getMaxImageCount()
- Parameters:
maxImageCount
- The maximum number of images to retain. Specify exactly one of maxImageCount and maxImageAge.- Returns:
this
-
rulePriority
Sets the value ofLifecycleRule.getRulePriority()
- Parameters:
rulePriority
- Controls the order in which rules are evaluated (low to high). 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.
- Returns:
this
-
tagPatternList
Sets the value ofLifecycleRule.getTagPatternList()
- Parameters:
tagPatternList
- Select images that have ALL the given patterns in their tag. 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
- Returns:
this
-
tagPrefixList
Sets the value ofLifecycleRule.getTagPrefixList()
- Parameters:
tagPrefixList
- Select images that have ALL the given prefixes in their tag. Both tagPrefixList and tagPatternList cannot be specified together in a rule.Only if tagStatus == TagStatus.Tagged
- Returns:
this
-
tagStatus
Sets the value ofLifecycleRule.getTagStatus()
- Parameters:
tagStatus
- Select images based on tags. Only one rule is allowed to select untagged images, and it must have the highest rulePriority.- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<LifecycleRule>
- Returns:
- a new instance of
LifecycleRule
- Throws:
NullPointerException
- if any required attribute was not provided
-