Class: Datadog::Lambda::AppSec::Request
- Inherits:
-
Object
- Object
- Datadog::Lambda::AppSec::Request
- Defined in:
- lib/datadog/lambda/appsec/request.rb
Overview
Minimal request object for AppSec event recording.
WARNING: It's a minimal data for interface compliance
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#remote_addr ⇒ Object
readonly
Returns the value of attribute remote_addr.
-
#request_method ⇒ Object
readonly
Returns the value of attribute request_method.
-
#user_agent ⇒ Object
readonly
Returns the value of attribute user_agent.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(remote_addr:, headers:, request_method:, path:) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(remote_addr:, headers:, request_method:, path:) ⇒ Request
Returns a new instance of Request.
35 36 37 38 39 40 41 42 |
# File 'lib/datadog/lambda/appsec/request.rb', line 35 def initialize(remote_addr:, headers:, request_method:, path:) @headers = headers @host = headers['host'] @user_agent = headers['user-agent'] @remote_addr = remote_addr @request_method = request_method @path = path end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
13 14 15 |
# File 'lib/datadog/lambda/appsec/request.rb', line 13 def headers @headers end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
13 14 15 |
# File 'lib/datadog/lambda/appsec/request.rb', line 13 def host @host end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
13 14 15 |
# File 'lib/datadog/lambda/appsec/request.rb', line 13 def path @path end |
#remote_addr ⇒ Object (readonly)
Returns the value of attribute remote_addr.
13 14 15 |
# File 'lib/datadog/lambda/appsec/request.rb', line 13 def remote_addr @remote_addr end |
#request_method ⇒ Object (readonly)
Returns the value of attribute request_method.
13 14 15 |
# File 'lib/datadog/lambda/appsec/request.rb', line 13 def request_method @request_method end |
#user_agent ⇒ Object (readonly)
Returns the value of attribute user_agent.
13 14 15 |
# File 'lib/datadog/lambda/appsec/request.rb', line 13 def user_agent @user_agent end |
Class Method Details
.from_normalized(event) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/datadog/lambda/appsec/request.rb', line 17 def from_normalized(event) new( remote_addr: event['source_ip'], headers: lowercase_headers(event), request_method: event['method'], path: event['path'] ) end |