Class: Datadog::Lambda::AppSec::Response

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

Overview

Minimal response object for AppSec event recording.

WARNING: It's a minimal data for interface compliance

See Also:

  • AppSec::APISecurity.sample?
  • AppSec::Contrib::Rack::Gateway::Response

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, headers:, body:) ⇒ Response

Returns a new instance of Response.



23
24
25
26
27
# File 'lib/datadog/lambda/appsec/response.rb', line 23

def initialize(status:, headers:, body:)
  @status = status
  @headers = headers
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



13
14
15
# File 'lib/datadog/lambda/appsec/response.rb', line 13

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



13
14
15
# File 'lib/datadog/lambda/appsec/response.rb', line 13

def headers
  @headers
end

#statusObject (readonly)

Returns the value of attribute status.



13
14
15
# File 'lib/datadog/lambda/appsec/response.rb', line 13

def status
  @status
end

Class Method Details

.from_normalized(normalized) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/datadog/lambda/appsec/response.rb', line 15

def self.from_normalized(normalized)
  new(
    status: normalized['status_code'].to_i,
    headers: normalized['headers'] || {},
    body: normalized['body']
  )
end