28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/datadog/core/remote/configuration/path.rb', line 28
def parse(path)
m = RE.match(path)
raise ParseError, "could not parse: #{path.inspect}" if m.nil?
org_id = m['org_id'] ? m['org_id'].to_i : nil
source = m['source']
raise ParseError, 'missing source value' unless source
source = source.delete("/#{org_id}") if org_id
product = m['product']
raise ParseError, 'missing product value' unless product
config_id = m['config_id']
raise ParseError, 'missing config_id value' unless config_id
name = m['name']
raise ParseError, 'missing name value' unless name
new(source: source, org_id: org_id, product: product, config_id: config_id, name: name)
end
|