Method: Datadog::Core::Remote::Configuration::TargetMap.parse

Defined in:
lib/datadog/core/remote/configuration/target.rb

.parse(hash) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/datadog/core/remote/configuration/target.rb', line 13

def parse(hash)
  opaque_backend_state = hash['signed']['custom']['opaque_backend_state']
  version = hash['signed']['version']

  map = new

  map.instance_eval do
    @opaque_backend_state = opaque_backend_state
    @version = version
  end

  hash['signed']['targets'].each_with_object(map) do |(p, t), m|
    path = Configuration::Path.parse(p)
    target = Configuration::Target.parse(t)

    m[path] = target
  end
end