module Arc

Public Class Methods

reflect() click to toggle source

Returns a hash of the current Architect runtime resources

# File lib/architect/reflect.rb, line 7
def self.reflect
  client = Aws::SSM::Client.new
  res = client.get_parameters_by_path({
    path: '/' + ENV['ARC_CLOUDFORMATION'],
    recursive: true,
  })
  res.parameters.reduce({}) do |result, param|
    bits = param.name.split('/').reject { |c| c.empty? }
    type = bits[1] # events, queues, tables, ws, static
    key = bits[2] # the name in the .arc file
    val = param.value # the name generated by cfn
    result[type] = {} unless result.key?(type)
    result[type][key] = val
    result
  end
end