Module: Datadog::CI::Transport::Api::Builder

Defined in:
lib/datadog/ci/transport/api/builder.rb

Class Method Summary collapse

Class Method Details

.build_agentless_api(settings) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/datadog/ci/transport/api/builder.rb', line 16

def self.build_agentless_api(settings)
  return nil if settings.api_key.nil?

  dd_site = settings.site || Ext::Transport::DEFAULT_DD_SITE

  citestcycle_url = settings.ci.agentless_url ||
    "https://#{Ext::Transport::TEST_VISIBILITY_INTAKE_HOST_PREFIX}.#{dd_site}:443"

  api_url = settings.ci.agentless_url ||
    "https://#{Ext::Transport::DD_API_HOST_PREFIX}.#{dd_site}:443"

  citestcov_url = settings.ci.agentless_url ||
    "https://#{Ext::Transport::TEST_COVERAGE_INTAKE_HOST_PREFIX}.#{dd_site}:443"

  Agentless.new(
    api_key: settings.api_key,
    citestcycle_url: citestcycle_url,
    api_url: api_url,
    citestcov_url: citestcov_url
  )
end

.build_evp_proxy_api(settings) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/datadog/ci/transport/api/builder.rb', line 38

def self.build_evp_proxy_api(settings)
  agent_settings = Datadog::Core::Configuration::AgentSettingsResolver.call(settings)
  negotiation = Datadog::Core::Remote::Negotiation.new(
    settings,
    agent_settings,
    suppress_logging: {no_config_endpoint: true}
  )

  evp_proxy_path_prefix = Ext::Transport::EVP_PROXY_PATH_PREFIXES.find do |path_prefix|
    negotiation.endpoint?(path_prefix)
  end

  return nil if evp_proxy_path_prefix.nil?

  EvpProxy.new(agent_settings: agent_settings, path_prefix: evp_proxy_path_prefix)
end