Class: Datadog::OpenFeature::Agentless::Transport
- Inherits:
-
Object
- Object
- Datadog::OpenFeature::Agentless::Transport
- Defined in:
- lib/datadog/open_feature/agentless/transport.rb
Overview
HTTP transport for agentless configuration delivery.
Instance Method Summary collapse
- #get(etag) ⇒ Object
-
#initialize(endpoint:, api_key:, timeout_seconds:) ⇒ Transport
constructor
A new instance of Transport.
Constructor Details
#initialize(endpoint:, api_key:, timeout_seconds:) ⇒ Transport
Returns a new instance of Transport.
18 19 20 21 22 |
# File 'lib/datadog/open_feature/agentless/transport.rb', line 18 def initialize(endpoint:, api_key:, timeout_seconds:) @endpoint = endpoint @api_key = endpoint.managed? ? api_key : nil @timeout_seconds = timeout_seconds end |
Instance Method Details
#get(etag) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/datadog/open_feature/agentless/transport.rb', line 24 def get(etag) request = Net::HTTP::Get.new(@endpoint.uri.request_uri, headers(etag)) apply_custom_authentication(request) response = request(request) status = response.code.to_i Response.new( status: status, etag: response["ETag"], # Decoding another status can erase the status the poller needs to classify the response. body: (status == 200) ? response_body(response) : nil, ) # Net::HTTP uses several version-specific exception types. None may end # the delivery worker; the poller classifies every transport failure. rescue => error Response.new(error: error) end |