Class: Datadog::Core::Remote::Configuration::TargetMap

Inherits:
Hash
  • Object
show all
Defined in:
lib/datadog/core/remote/configuration/target.rb

Overview

TargetMap stores information regarding Configuration::Path and Configuration::Target

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTargetMap

Returns a new instance of TargetMap.



35
36
37
38
39
40
# File 'lib/datadog/core/remote/configuration/target.rb', line 35

def initialize
  super

  @opaque_backend_state = nil
  @version = nil
end

Instance Attribute Details

#opaque_backend_stateObject (readonly)

Returns the value of attribute opaque_backend_state.



33
34
35
# File 'lib/datadog/core/remote/configuration/target.rb', line 33

def opaque_backend_state
  @opaque_backend_state
end

#versionObject (readonly)

Returns the value of attribute version.



33
34
35
# File 'lib/datadog/core/remote/configuration/target.rb', line 33

def version
  @version
end

Class Method Details

.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