Class: LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError
- Inherits:
-
Error
- Object
- Error
- LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError
- Defined in:
- lib/logstash/outputs/elasticsearch/http_client/pool.rb
Instance Attribute Summary collapse
-
#request_body ⇒ Object
readonly
Returns the value of attribute request_body.
-
#response_body ⇒ Object
readonly
Returns the value of attribute response_body.
-
#response_code ⇒ Object
readonly
Returns the value of attribute response_code.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #forbidden? ⇒ Boolean
-
#initialize(response_code, url, request_body, response_body) ⇒ BadResponseCodeError
constructor
A new instance of BadResponseCodeError.
- #invalid_credentials? ⇒ Boolean
- #invalid_eav_header? ⇒ Boolean
- #too_many_requests? ⇒ Boolean
Constructor Details
#initialize(response_code, url, request_body, response_body) ⇒ BadResponseCodeError
Returns a new instance of BadResponseCodeError.
10 11 12 13 14 15 16 17 |
# File 'lib/logstash/outputs/elasticsearch/http_client/pool.rb', line 10 def initialize(response_code, url, request_body, response_body) super("Got response code '#{response_code}' contacting Elasticsearch at URL '#{url}'") @response_code = response_code @url = url @request_body = request_body @response_body = response_body end |
Instance Attribute Details
#request_body ⇒ Object (readonly)
Returns the value of attribute request_body.
8 9 10 |
# File 'lib/logstash/outputs/elasticsearch/http_client/pool.rb', line 8 def request_body @request_body end |
#response_body ⇒ Object (readonly)
Returns the value of attribute response_body.
8 9 10 |
# File 'lib/logstash/outputs/elasticsearch/http_client/pool.rb', line 8 def response_body @response_body end |
#response_code ⇒ Object (readonly)
Returns the value of attribute response_code.
8 9 10 |
# File 'lib/logstash/outputs/elasticsearch/http_client/pool.rb', line 8 def response_code @response_code end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/logstash/outputs/elasticsearch/http_client/pool.rb', line 8 def url @url end |
Instance Method Details
#forbidden? ⇒ Boolean
27 28 29 |
# File 'lib/logstash/outputs/elasticsearch/http_client/pool.rb', line 27 def forbidden? @response_code == 403 end |
#invalid_credentials? ⇒ Boolean
23 24 25 |
# File 'lib/logstash/outputs/elasticsearch/http_client/pool.rb', line 23 def invalid_credentials? @response_code == 401 end |
#invalid_eav_header? ⇒ Boolean
19 20 21 |
# File 'lib/logstash/outputs/elasticsearch/http_client/pool.rb', line 19 def invalid_eav_header? @response_code == 400 && @response_body&.include?(ELASTIC_API_VERSION) end |
#too_many_requests? ⇒ Boolean
31 32 33 |
# File 'lib/logstash/outputs/elasticsearch/http_client/pool.rb', line 31 def too_many_requests? @response_code == 429 end |