Class: Datadog::AppSec::Configuration::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/appsec/configuration.rb

Overview

Configuration DSL implementation

Constant Summary collapse

Instrument =

Struct constant whisker cast for Steep

_ = Struct.new(:name, :options)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDSL

Returns a new instance of DSL.



20
21
22
23
# File 'lib/datadog/appsec/configuration.rb', line 20

def initialize
  @instruments = []
  @options = {}
end

Instance Attribute Details

#instrumentsObject (readonly)

Returns the value of attribute instruments.



25
26
27
# File 'lib/datadog/appsec/configuration.rb', line 25

def instruments
  @instruments
end

#optionsObject (readonly)

Returns the value of attribute options.



25
26
27
# File 'lib/datadog/appsec/configuration.rb', line 25

def options
  @options
end

Instance Method Details

#[](key) ⇒ Object



68
69
70
71
72
# File 'lib/datadog/appsec/configuration.rb', line 68

def [](key)
  found = @instruments.find { |e| e.name == key }

  found.options if found
end

#enabled=(value) ⇒ Object



31
32
33
# File 'lib/datadog/appsec/configuration.rb', line 31

def enabled=(value)
  options[:enabled] = value
end

#instrument(name, options = {}) ⇒ Object



27
28
29
# File 'lib/datadog/appsec/configuration.rb', line 27

def instrument(name, options = {})
  @instruments << Instrument.new(name, options)
end

#ip_denylist=(value) ⇒ Object



39
40
41
# File 'lib/datadog/appsec/configuration.rb', line 39

def ip_denylist=(value)
  options[:ip_denylist] = value
end

#obfuscator_key_regex=(value) ⇒ Object



60
61
62
# File 'lib/datadog/appsec/configuration.rb', line 60

def obfuscator_key_regex=(value)
  options[:obfuscator_key_regex] = value
end

#obfuscator_value_regex=(value) ⇒ Object



64
65
66
# File 'lib/datadog/appsec/configuration.rb', line 64

def obfuscator_value_regex=(value)
  options[:obfuscator_value_regex] = value
end

#ruleset=(value) ⇒ Object



35
36
37
# File 'lib/datadog/appsec/configuration.rb', line 35

def ruleset=(value)
  options[:ruleset] = value
end

#trace_rate_limit=(value) ⇒ Object



56
57
58
# File 'lib/datadog/appsec/configuration.rb', line 56

def trace_rate_limit=(value)
  options[:trace_rate_limit] = value
end

#user_id_denylist=(value) ⇒ Object



43
44
45
# File 'lib/datadog/appsec/configuration.rb', line 43

def user_id_denylist=(value)
  options[:user_id_denylist] = value
end

#waf_debug=(value) ⇒ Object



52
53
54
# File 'lib/datadog/appsec/configuration.rb', line 52

def waf_debug=(value)
  options[:waf_debug] = value
end

#waf_timeout=(value) ⇒ Object

in microseconds



48
49
50
# File 'lib/datadog/appsec/configuration.rb', line 48

def waf_timeout=(value)
  options[:waf_timeout] = value
end