Class: Datadog::CI::Transport::Api::EvpProxy

Inherits:
Base
  • Object
show all
Defined in:
lib/datadog/ci/transport/api/evp_proxy.rb

Instance Method Summary collapse

Methods inherited from Base

#headers_with_default

Constructor Details

#initialize(agent_settings:, path_prefix: Ext::Transport::EVP_PROXY_V2_PATH_PREFIX) ⇒ EvpProxy

Returns a new instance of EvpProxy.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/datadog/ci/transport/api/evp_proxy.rb', line 13

def initialize(agent_settings:, path_prefix: Ext::Transport::EVP_PROXY_V2_PATH_PREFIX)
  @agent_intake_http = build_http_client(
    agent_settings,
    compress: Ext::Transport::EVP_PROXY_COMPRESSION_SUPPORTED[path_prefix]
  )

  @agent_api_http = build_http_client(agent_settings, compress: false)

  path_prefix = "#{path_prefix}/" unless path_prefix.end_with?("/")
  @path_prefix = path_prefix
end

Instance Method Details

#api_request(path:, payload:, headers: {}, verb: "post") ⇒ Object



33
34
35
36
37
38
39
# File 'lib/datadog/ci/transport/api/evp_proxy.rb', line 33

def api_request(path:, payload:, headers: {}, verb: "post")
  super

  headers[Ext::Transport::HEADER_EVP_SUBDOMAIN] = Ext::Transport::DD_API_HOST_PREFIX

  perform_request(@agent_api_http, path: path, payload: payload, headers: headers, verb: verb)
end

#citestcov_request(path:, payload:, headers: {}, verb: "post") ⇒ Object



41
42
43
44
45
46
47
# File 'lib/datadog/ci/transport/api/evp_proxy.rb', line 41

def citestcov_request(path:, payload:, headers: {}, verb: "post")
  super

  headers[Ext::Transport::HEADER_EVP_SUBDOMAIN] = Ext::Transport::TEST_COVERAGE_INTAKE_HOST_PREFIX

  perform_request(@agent_intake_http, path: path, payload: @citestcov_payload, headers: headers, verb: verb)
end

#citestcycle_request(path:, payload:, headers: {}, verb: "post") ⇒ Object



25
26
27
28
29
30
31
# File 'lib/datadog/ci/transport/api/evp_proxy.rb', line 25

def citestcycle_request(path:, payload:, headers: {}, verb: "post")
  super

  headers[Ext::Transport::HEADER_EVP_SUBDOMAIN] = Ext::Transport::TEST_VISIBILITY_INTAKE_HOST_PREFIX

  perform_request(@agent_intake_http, path: path, payload: payload, headers: headers, verb: verb)
end