Class: Aws::ECR::Types::ImageDetail

Inherits:
Object
  • Object
show all
Defined in:
lib/awsclean/aws_extensions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#elegible_for_cleanupObject

Returns the value of attribute elegible_for_cleanup


25
26
27
# File 'lib/awsclean/aws_extensions.rb', line 25

def elegible_for_cleanup
  @elegible_for_cleanup
end

#in_useObject

Returns the value of attribute in_use


25
26
27
# File 'lib/awsclean/aws_extensions.rb', line 25

def in_use
  @in_use
end

#regionObject

Returns the value of attribute region


25
26
27
# File 'lib/awsclean/aws_extensions.rb', line 25

def region
  @region
end

Instance Method Details

#days_since_creationObject


27
28
29
# File 'lib/awsclean/aws_extensions.rb', line 27

def days_since_creation
  (DateTime.now - image_pushed_at.to_datetime).to_i
end

#image_urisObject


35
36
37
# File 'lib/awsclean/aws_extensions.rb', line 35

def image_uris
  (image_tags || []).map { |tag| repository_uri << ':' << tag }
end

#repository_uriObject


39
40
41
42
43
# File 'lib/awsclean/aws_extensions.rb', line 39

def repository_uri
  sprintf('%i.dkr.ecr.%s.amazonaws.com/%s',
    registry_id, region, repository_name,
  )
end

#stale?(max_age) ⇒ Boolean

Returns:

  • (Boolean)

31
32
33
# File 'lib/awsclean/aws_extensions.rb', line 31

def stale?(max_age)
  days_since_creation >= max_age
end