Class: AWSCDK::ECR::LifecycleRule

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ecr/lifecycle_rule.rb

Overview

An ECR life cycle rule.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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.

Parameters:

  • description (String, nil) (defaults to: nil)

    Describes the purpose of the rule.

  • max_image_age (AWSCDK::Duration, nil) (defaults to: nil)

    The maximum age of images to retain. The value must represent a number of days.

  • max_image_count (Numeric, nil) (defaults to: nil)

    The maximum number of images to retain.

  • rule_priority (Numeric, nil) (defaults to: nil)

    Controls the order in which rules are evaluated (low to high).

  • tag_pattern_list (Array<String>, nil) (defaults to: nil)

    Select images that have ALL the given patterns in their tag.

  • tag_prefix_list (Array<String>, nil) (defaults to: nil)

    Select images that have ALL the given prefixes in their tag.

  • tag_status (AWSCDK::ECR::TagStatus, nil) (defaults to: nil)

    Select images based on tags.



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

#descriptionString? (readonly)

Note:

Default: No description

Describes the purpose of the rule.

Returns:

  • (String, nil)


35
36
37
# File 'ecr/lifecycle_rule.rb', line 35

def description
  @description
end

#max_image_ageAWSCDK::Duration? (readonly)

The maximum age of images to retain. The value must represent a number of days.

Specify exactly one of maxImageCount and maxImageAge.

Returns:



41
42
43
# File 'ecr/lifecycle_rule.rb', line 41

def max_image_age
  @max_image_age
end

#max_image_countNumeric? (readonly)

The maximum number of images to retain.

Specify exactly one of maxImageCount and maxImageAge.

Returns:

  • (Numeric, nil)


47
48
49
# File 'ecr/lifecycle_rule.rb', line 47

def max_image_count
  @max_image_count
end

#rule_priorityNumeric? (readonly)

Note:

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.

Returns:

  • (Numeric, nil)


61
62
63
# File 'ecr/lifecycle_rule.rb', line 61

def rule_priority
  @rule_priority
end

#tag_pattern_listArray<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

Returns:

  • (Array<String>, nil)


74
75
76
# File 'ecr/lifecycle_rule.rb', line 74

def tag_pattern_list
  @tag_pattern_list
end

#tag_prefix_listArray<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

Returns:

  • (Array<String>, nil)


83
84
85
# File 'ecr/lifecycle_rule.rb', line 83

def tag_prefix_list
  @tag_prefix_list
end

#tag_statusAWSCDK::ECR::TagStatus? (readonly)

Note:

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.

Returns:



91
92
93
# File 'ecr/lifecycle_rule.rb', line 91

def tag_status
  @tag_status
end

Class Method Details

.jsii_propertiesObject



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_jsiiObject



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