Module: Arc

Defined in:
lib/architect/ws.rb,
lib/architect/http.rb,
lib/architect/events.rb,
lib/architect/queues.rb,
lib/architect/tables.rb,
lib/architect/reflect.rb,
lib/architect/functions.rb

Defined Under Namespace

Modules: Events, HTTP, Queues, Tables, WS

Class Method Summary collapse

Class Method Details

.reflectObject

Returns a hash of the current Architect runtime resources



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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