Class: AWSCDK::ECR::LifecycleRule
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::ECR::LifecycleRule
- Defined in:
- ecr/lifecycle_rule.rb
Overview
An ECR life cycle rule.
Instance Attribute Summary collapse
-
#description ⇒ String?
readonly
Describes the purpose of the rule.
-
#max_image_age ⇒ AWSCDK::Duration?
readonly
The maximum age of images to retain.
-
#max_image_count ⇒ Numeric?
readonly
The maximum number of images to retain.
-
#rule_priority ⇒ Numeric?
readonly
Controls the order in which rules are evaluated (low to high).
-
#tag_pattern_list ⇒ Array<String>?
readonly
Select images that have ALL the given patterns in their tag.
-
#tag_prefix_list ⇒ Array<String>?
readonly
Select images that have ALL the given prefixes in their tag.
-
#tag_status ⇒ AWSCDK::ECR::TagStatus?
readonly
Select images based on tags.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(description: nil, max_image_age: nil, max_image_count: nil, rule_priority: nil, tag_pattern_list: nil, tag_prefix_list: nil, tag_status: nil) ⇒ LifecycleRule
constructor
A new instance of LifecycleRule.
- #to_jsii ⇒ Object
Constructor Details
#initialize(description: nil, max_image_age: nil, max_image_count: nil, rule_priority: nil, tag_pattern_list: nil, tag_prefix_list: nil, tag_status: nil) ⇒ LifecycleRule
Returns a new instance of LifecycleRule.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'ecr/lifecycle_rule.rb', line 14 def initialize(description: nil, max_image_age: nil, max_image_count: nil, rule_priority: nil, tag_pattern_list: nil, tag_prefix_list: nil, tag_status: nil) @description = description Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil? @max_image_age = max_image_age Jsii::Type.check_type(@max_image_age, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "maxImageAge") unless @max_image_age.nil? @max_image_count = max_image_count Jsii::Type.check_type(@max_image_count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxImageCount") unless @max_image_count.nil? @rule_priority = rule_priority Jsii::Type.check_type(@rule_priority, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "rulePriority") unless @rule_priority.nil? @tag_pattern_list = tag_pattern_list Jsii::Type.check_type(@tag_pattern_list, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tagPatternList") unless @tag_pattern_list.nil? @tag_prefix_list = tag_prefix_list Jsii::Type.check_type(@tag_prefix_list, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tagPrefixList") unless @tag_prefix_list.nil? @tag_status = tag_status Jsii::Type.check_type(@tag_status, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNyLlRhZ1N0YXR1cyJ9")), "tagStatus") unless @tag_status.nil? end |
Instance Attribute Details
#description ⇒ String? (readonly)
Default: No description
Describes the purpose of the rule.
35 36 37 |
# File 'ecr/lifecycle_rule.rb', line 35 def description @description end |
#max_image_age ⇒ AWSCDK::Duration? (readonly)
The maximum age of images to retain. The value must represent a number of days.
Specify exactly one of maxImageCount and maxImageAge.
41 42 43 |
# File 'ecr/lifecycle_rule.rb', line 41 def max_image_age @max_image_age end |
#max_image_count ⇒ Numeric? (readonly)
The maximum number of images to retain.
Specify exactly one of maxImageCount and maxImageAge.
47 48 49 |
# File 'ecr/lifecycle_rule.rb', line 47 def max_image_count @max_image_count end |
#rule_priority ⇒ Numeric? (readonly)
Default: Automatically assigned
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.
61 62 63 |
# File 'ecr/lifecycle_rule.rb', line 61 def rule_priority @rule_priority end |
#tag_pattern_list ⇒ Array<String>? (readonly)
Select images that have ALL the given patterns in their tag.
There is a maximum limit of four wildcards () per string. For example, ["*test*1*2*3", "test*1*2*3"] is valid but ["test*1*2*3*4*5*6"] is invalid.
Both tagPrefixList and tagPatternList cannot be specified together in a rule.
Only if tagStatus == TagStatus.Tagged
74 75 76 |
# File 'ecr/lifecycle_rule.rb', line 74 def tag_pattern_list @tag_pattern_list end |
#tag_prefix_list ⇒ Array<String>? (readonly)
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
83 84 85 |
# File 'ecr/lifecycle_rule.rb', line 83 def tag_prefix_list @tag_prefix_list end |
#tag_status ⇒ AWSCDK::ECR::TagStatus? (readonly)
Default: TagStatus.Tagged if tagPrefixList or tagPatternList is given, TagStatus.Any otherwise
Select images based on tags.
Only one rule is allowed to select untagged images, and it must have the highest rulePriority.
91 92 93 |
# File 'ecr/lifecycle_rule.rb', line 91 def tag_status @tag_status end |
Class Method Details
.jsii_properties ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 |
# File 'ecr/lifecycle_rule.rb', line 93 def self.jsii_properties { :description => "description", :max_image_age => "maxImageAge", :max_image_count => "maxImageCount", :rule_priority => "rulePriority", :tag_pattern_list => "tagPatternList", :tag_prefix_list => "tagPrefixList", :tag_status => "tagStatus", } end |
Instance Method Details
#to_jsii ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'ecr/lifecycle_rule.rb', line 105 def to_jsii result = {} result.merge!({ "description" => @description, "maxImageAge" => @max_image_age, "maxImageCount" => @max_image_count, "rulePriority" => @rule_priority, "tagPatternList" => @tag_pattern_list, "tagPrefixList" => @tag_prefix_list, "tagStatus" => @tag_status, }) result.compact end |