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.



18
19
20
21
# File 'lib/datadog/appsec/configuration.rb', line 18

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

Instance Attribute Details

#instrumentsObject (readonly)

Returns the value of attribute instruments.



23
24
25
# File 'lib/datadog/appsec/configuration.rb', line 23

def instruments
  @instruments
end

#optionsObject (readonly)

Returns the value of attribute options.



23
24
25
# File 'lib/datadog/appsec/configuration.rb', line 23

def options
  @options
end

Instance Method Details

#[](key) ⇒ Object



66
67
68
69
70
# File 'lib/datadog/appsec/configuration.rb', line 66

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

  found.options if found
end

#enabled=(value) ⇒ Object



29
30
31
# File 'lib/datadog/appsec/configuration.rb', line 29

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

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



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

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

#ip_denylist=(value) ⇒ Object



37
38
39
# File 'lib/datadog/appsec/configuration.rb', line 37

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

#obfuscator_key_regex=(value) ⇒ Object



58
59
60
# File 'lib/datadog/appsec/configuration.rb', line 58

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

#obfuscator_value_regex=(value) ⇒ Object



62
63
64
# File 'lib/datadog/appsec/configuration.rb', line 62

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

#ruleset=(value) ⇒ Object



33
34
35
# File 'lib/datadog/appsec/configuration.rb', line 33

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

#trace_rate_limit=(value) ⇒ Object



54
55
56
# File 'lib/datadog/appsec/configuration.rb', line 54

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

#user_id_denylist=(value) ⇒ Object



41
42
43
# File 'lib/datadog/appsec/configuration.rb', line 41

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

#waf_debug=(value) ⇒ Object



50
51
52
# File 'lib/datadog/appsec/configuration.rb', line 50

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

#waf_timeout=(value) ⇒ Object

in microseconds



46
47
48
# File 'lib/datadog/appsec/configuration.rb', line 46

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