Class: Honeycomb::Aws::ApiHandler::S3Redirect
- Inherits:
-
Object
- Object
- Honeycomb::Aws::ApiHandler::S3Redirect
- Defined in:
- lib/honeycomb/integrations/aws.rb
Overview
Constant Summary collapse
- REGION_TAG =
%r{<Region>(.+?)</Region>}.freeze
Instance Method Summary collapse
- #happening? ⇒ Boolean
-
#initialize(context) ⇒ S3Redirect
constructor
A new instance of S3Redirect.
- #original_host ⇒ Object
- #region ⇒ Object
- #region_from_body ⇒ Object
- #region_from_headers ⇒ Object
- #status ⇒ Object
Constructor Details
#initialize(context) ⇒ S3Redirect
Returns a new instance of S3Redirect.
344 345 346 |
# File 'lib/honeycomb/integrations/aws.rb', line 344 def initialize(context) @context = context end |
Instance Method Details
#happening? ⇒ Boolean
356 357 358 |
# File 'lib/honeycomb/integrations/aws.rb', line 356 def happening? status == 400 && region && !original_host.include?("fips") end |
#original_host ⇒ Object
348 349 350 |
# File 'lib/honeycomb/integrations/aws.rb', line 348 def original_host @context.http_request.endpoint.host end |
#region ⇒ Object
360 361 362 |
# File 'lib/honeycomb/integrations/aws.rb', line 360 def region @region ||= region_from_headers || region_from_body end |
#region_from_body ⇒ Object
368 369 370 371 |
# File 'lib/honeycomb/integrations/aws.rb', line 368 def region_from_body body = @context.http_response.body_contents body.match(REGION_TAG) { |tag| tag[1] } end |
#region_from_headers ⇒ Object
364 365 366 |
# File 'lib/honeycomb/integrations/aws.rb', line 364 def region_from_headers @context.http_response.headers["x-amz-bucket-region"] end |
#status ⇒ Object
352 353 354 |
# File 'lib/honeycomb/integrations/aws.rb', line 352 def status @context.http_response.status_code end |