-
Notifications
You must be signed in to change notification settings - Fork 375
/
api.rb
57 lines (49 loc) · 1.51 KB
/
api.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# frozen_string_literal: true
require_relative '../../encoding'
require_relative '../../../../ddtrace/transport/http/api/map'
# TODO: Decouple standard transport/http/api/instance
#
# Separate classes are needed because transport/http/traces includes
# Trace::API::Instance which closes over and uses a single spec, which is
# negotiated as either /v3 or /v4 for the whole API at the spec level, but we
# need an independent toplevel path at the endpoint level.
#
# Separate classes are needed because of `include Trace::API::Instance`.
#
# Below should be:
# require_relative '../../../../ddtrace/transport/http/api/spec'
require_relative 'api/spec'
# TODO: only needed for Negotiation::API::Endpoint
require_relative 'negotiation'
# TODO: only needed for Config::API::Endpoint
require_relative 'config'
module Datadog
module Core
module Transport
module HTTP
# Namespace for API components
module API
# Default API versions
ROOT = 'root'
V7 = 'v0.7'
module_function
def defaults
Datadog::Transport::HTTP::API::Map[
ROOT => Spec.new do |s|
s.info = Negotiation::API::Endpoint.new(
'/info',
)
end,
V7 => Spec.new do |s|
s.config = Config::API::Endpoint.new(
'/v0.7/config',
Core::Encoding::JSONEncoder,
)
end,
]
end
end
end
end
end
end