module Builderator::Control::Data

Wrapper module for lookup controllers

Public Class Methods

image(query = {}) click to toggle source
# File lib/builderator/control/data/image.rb, line 10
def self.image(query = {})
  Image.search(query)
end
lookup(source, query) click to toggle source
# 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 = {}) click to toggle source

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.

# 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