Module: Builderator::Control::Data

Defined in:
lib/builderator/control/data.rb,
lib/builderator/control/data/ecr.rb,
lib/builderator/control/data/image.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Image

Class Method Summary collapse

Class Method Details

.image(query = {}) ⇒ Object



10
11
12
# File 'lib/builderator/control/data/image.rb', line 10

def self.image(query = {})
  Image.search(query)
end

.lookup(source, query) ⇒ Object



7
8
9
10
11
# File 'lib/builderator/control/data.rb', line 7

def self.lookup(source, query)
  fail "#{ source } is not a valid data type!" unless respond_to?(source)

  send(source, query)
end

.repository(query = {}) ⇒ Object

Lookup ECR repository info

NB. We want to embed the login_server info into the returned repo data for ease of use. Thus, instead of an AWS struct-type, we get a hash with the injected value.



15
16
17
18
19
# File 'lib/builderator/control/data/ecr.rb', line 15

def self.repository(query = {})
ECR.search(query).map do |repo|
  repo.to_h.tap { |r| r[:login_server] = "https://#{repo.repository_uri.sub(repo.repository_name, '')}" }
  end
end