dogapi 1.40.0 → 1.45.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.azure-pipelines/all.yml +36 -8
  3. data/.rubocop.yml +4 -0
  4. data/.rubocop_todo.yml +1 -0
  5. data/CHANGELOG.md +24 -0
  6. data/Gemfile +1 -3
  7. data/Gemfile_1.9 +1 -3
  8. data/RELEASING.md +1 -1
  9. data/lib/capistrano/datadog.rb +2 -2
  10. data/lib/capistrano/datadog/v2.rb +2 -2
  11. data/lib/capistrano/datadog/v3.rb +3 -2
  12. data/lib/dogapi/common.rb +29 -12
  13. data/lib/dogapi/facade.rb +55 -29
  14. data/lib/dogapi/v1.rb +1 -0
  15. data/lib/dogapi/v1/alert.rb +0 -2
  16. data/lib/dogapi/v1/aws_integration.rb +0 -2
  17. data/lib/dogapi/v1/aws_logs.rb +0 -2
  18. data/lib/dogapi/v1/azure_integration.rb +0 -2
  19. data/lib/dogapi/v1/comment.rb +0 -2
  20. data/lib/dogapi/v1/dash.rb +0 -2
  21. data/lib/dogapi/v1/dashboard.rb +12 -2
  22. data/lib/dogapi/v1/dashboard_list.rb +0 -2
  23. data/lib/dogapi/v1/embed.rb +0 -2
  24. data/lib/dogapi/v1/event.rb +0 -2
  25. data/lib/dogapi/v1/gcp_integration.rb +0 -2
  26. data/lib/dogapi/v1/hosts.rb +0 -2
  27. data/lib/dogapi/v1/integration.rb +0 -2
  28. data/lib/dogapi/v1/logs_pipeline.rb +41 -0
  29. data/lib/dogapi/v1/metadata.rb +0 -2
  30. data/lib/dogapi/v1/metric.rb +0 -2
  31. data/lib/dogapi/v1/monitor.rb +0 -2
  32. data/lib/dogapi/v1/screenboard.rb +0 -2
  33. data/lib/dogapi/v1/search.rb +0 -2
  34. data/lib/dogapi/v1/service_check.rb +0 -2
  35. data/lib/dogapi/v1/service_level_objective.rb +3 -1
  36. data/lib/dogapi/v1/snapshot.rb +0 -2
  37. data/lib/dogapi/v1/synthetics.rb +3 -1
  38. data/lib/dogapi/v1/tag.rb +0 -2
  39. data/lib/dogapi/v1/usage.rb +0 -2
  40. data/lib/dogapi/v1/user.rb +0 -2
  41. data/lib/dogapi/v2/dashboard_list.rb +0 -2
  42. data/lib/dogapi/version.rb +1 -1
  43. data/spec/integration/dashboard_spec.rb +11 -1
  44. data/spec/integration/logs_pipeline_spec.rb +43 -0
  45. data/spec/spec_helper.rb +13 -1
  46. data/spec/unit/common_spec.rb +19 -10
  47. metadata +8 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03dcbb8f50795fb901c13effb712107ac78beb545d55bebccb9f2cfc83c92908
4
- data.tar.gz: d6cbb3c3dd0807d8d684879fa3efb44e8a54acd7c07298261ebc11b5b9a099e4
3
+ metadata.gz: 1ef3fbebc71af23718db2e177c11400648e47e0e770c8783021a8e7a1b7df099
4
+ data.tar.gz: 59ef0c8d5c187e7161a25166b468fa91c640ab568dd22992aa037b38c7461ff1
5
5
  SHA512:
6
- metadata.gz: 4b969abe11bd88812b9eb70066fb1d1fb2ff5df49a5a95de7c92893357dde80af0e5636500b1a7ed9703ce525a96d10662ff4900d09fd2676db263be17dfcaaf
7
- data.tar.gz: 3b63c822096ba541151e837c16d47c0aa298baff22257be5b098e13041bba0dd00bba328d479240d17b2c58c9a1c9cacfdbf33a9416752b5a61a4dd65a999457
6
+ metadata.gz: 48239d6fd49a735c74eb4c95f97093c0e599a8d11d868e784cb08ce1a96ce0a6da6b942e78afadc870fcb7e09bf0b53205c0517d502029cc17d3c3a378d5bbfa
7
+ data.tar.gz: 658b9c7f91b18e7744b1d3761e6e1d5212e527f293d09ba4a00f3303602262c46cf0c5743ec317e4bdb353286a1c94a9de51b86285b9513f310e7f6e72f4ca0c
@@ -9,10 +9,36 @@ pr:
9
9
  include:
10
10
  - master
11
11
 
12
+ resources:
13
+ containers:
14
+ - container: datadog-agent
15
+ image: datadog/agent:7
16
+ options: --health-cmd="exit 0" --health-interval=1s
17
+ ports:
18
+ - 8125:8125
19
+ - 8126:8126/tcp
20
+ env:
21
+ DD_API_KEY: $(ddAPIKey)
22
+ DD_APM_ENABLED: "true"
23
+ DD_APM_NON_LOCAL_TRAFFIC: "true"
24
+ DD_LOGS_ENABLED: "true"
25
+ DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL: "true"
26
+ DD_AC_EXCLUDE: "name:datadog-agent"
27
+ volumes:
28
+ - /var/run/docker.sock:/var/run/docker.sock:ro
29
+ - /proc/:/host/proc/:ro
30
+ - /sys/fs/cgroup/:/host/sys/fs/cgroup:ro
31
+
12
32
  jobs:
13
33
  - job: UnitTests
14
34
  pool:
15
35
  vmImage: "Ubuntu-16.04"
36
+ container:
37
+ image: ruby:$(RUBY_VERSION)
38
+ options: >-
39
+ -l com.datadoghq.ad.logs="[{\"source\": \"Azure Pipeline\", \"service\": \"dogapi-rb\"}]"
40
+ services:
41
+ datadog-agent: datadog-agent
16
42
  strategy:
17
43
  matrix:
18
44
  Rb24:
@@ -31,17 +57,19 @@ jobs:
31
57
  RUBY_VERSION: '2.6'
32
58
  TASK: rubocop
33
59
  steps:
34
- - task: UseRubyVersion@0
35
- displayName: Use Ruby $(RUBY_VERSION)
36
- inputs:
37
- versionSpec: $(RUBY_VERSION)
38
- addToPath: true
39
- - script: |
40
- gem install bundler
41
- bundle install --retry=3 --jobs=4
60
+ - script: bundle install --retry=3 --jobs=4
42
61
  displayName: 'bundle install'
62
+ env:
63
+ GEM_HOME: '~/.gem'
43
64
  - script: bundle exec rake $(TASK)
44
65
  displayName: Run $(TASK) via bundle
66
+ env:
67
+ GEM_HOME: '~/.gem'
68
+ DD_AGENT_HOST: datadog-agent
69
+ DD_ENV: ci
70
+ DD_SERVICE: dogapi-rb
71
+ DD_TAGS: "team:integration-tools-and-libraries,runtime:ruby-$(RUBY_VERSION),ci.job.name:$(System.JobName),matrix:$(TASK)"
72
+ DD_TRACE_ANALYTICS_ENABLED: "true"
45
73
  - job: TestRuby19
46
74
  pool:
47
75
  vmImage: "Ubuntu-16.04"
@@ -14,4 +14,8 @@ Metrics/LineLength:
14
14
  Metrics/ModuleLength:
15
15
  Max: 200
16
16
 
17
+ # Our Client constructor has 8 arguments
18
+ Metrics/ParameterLists:
19
+ Enabled: false
20
+
17
21
  inherit_from: .rubocop_todo.yml
@@ -241,6 +241,7 @@ Style/AccessorMethodName:
241
241
  - 'lib/dogapi/v1/dash.rb'
242
242
  - 'lib/dogapi/v1/dashboard.rb'
243
243
  - 'lib/dogapi/v1/embed.rb'
244
+ - 'lib/dogapi/v1/logs_pipeline.rb'
244
245
  - 'lib/dogapi/v1/screenboard.rb'
245
246
  - 'lib/dogapi/v1/synthetics.rb'
246
247
  - 'lib/dogapi/v1/user.rb'
@@ -1,5 +1,29 @@
1
1
  # Changes
2
2
 
3
+ ## 1.45.0 / 2021-01-27
4
+
5
+ * [Added] Read `datadog_host` cap variable for specifying Datadog API endpoint. See [#255](https://github.com/DataDog/dogapi-rb/pull/255).
6
+ * [Added] Added support for logs pipelines CRUD methods. See [#252](https://github.com/DataDog/dogapi-rb/pull/252). Thanks [hi-artem](https://github.com/hi-artem).
7
+ * [Fixed] Properly handle string response code. See [#254](https://github.com/DataDog/dogapi-rb/pull/254).
8
+ * [Fixed] Remove circular dependency. See [#253](https://github.com/DataDog/dogapi-rb/pull/253).
9
+
10
+ ## 1.44.0 / 2020-12-10
11
+
12
+ * [Added] Allow skipping SSL verification. See [#246](https://github.com/DataDog/dogapi-rb/pull/246).
13
+
14
+ ## 1.43.0 / 2020-12-07
15
+
16
+ * [Fixed] find_localhost: Try both `hostname` and `hostname -f` before raising. See [#242](https://github.com/DataDog/dogapi-rb/pull/242).
17
+
18
+ ## 1.42.0 / 2020-09-17
19
+
20
+ * [Added] Allow dashboard creation / updates using Template Variable Presets. See [#238](https://github.com/DataDog/dogapi-rb/pull/238).
21
+
22
+ ## 1.41.0 / 2020-07-27
23
+
24
+ * [Added] Improve user-agent header to include telemetry information. See [#235](https://github.com/DataDog/dogapi-rb/pull/235).
25
+ * [Added] Move setting hostname to end of method body in order to actually return it. See [#233](https://github.com/DataDog/dogapi-rb/pull/233).
26
+
3
27
  ## 1.40.0 / 2020-04-06
4
28
 
5
29
  * [Added] Re-add service level objectives support. See [#224](https://github.com/DataDog/dogapi-rb/pull/224).
data/Gemfile CHANGED
@@ -3,10 +3,8 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :test do
6
+ gem 'ddtrace', git: 'https://github.com/datadog/dd-trace-rb'
6
7
  gem 'rubocop', "~> 0.49.0"
7
- # NOTE: rake < 12.3.3 is vulnerable to CVE-2020-8130, but we only use it as a test dependency
8
- # and neither our users nor our CI is vulnerable in any way
9
- gem 'rake', '>= 2.4.2'
10
8
  gem 'rspec'
11
9
  gem 'simplecov'
12
10
  gem 'webmock'
@@ -4,10 +4,8 @@ gemspec
4
4
 
5
5
  group :test do
6
6
  gem 'rubocop', "~> 0.41.0"
7
- # NOTE: rake < 12.3.3 is vulnerable to CVE-2020-8130, but we only use it as a test dependency
8
- # and neither our users nor our CI is vulnerable in any way
9
- gem 'rake', '>= 2.4.2'
10
7
  gem 'rspec'
11
8
  gem 'simplecov', "~> 0.11.2"
12
9
  gem 'webmock'
10
+ gem 'crack', '<= 0.4.4'
13
11
  end
@@ -43,4 +43,4 @@ Install [bundler](https://bundler.io/) and setup your RubyGems credentials:
43
43
  1. Build the gem: `bundle exec gem build dogapi.gemspec`.
44
44
  1. Push the gem: `bundle exec gem push dogapi-x.x.x.gem`.
45
45
  1. Check that the [Ruby Gem is published](https://rubygems.org/gems/dogapi).
46
- 1. Bump the version again in `lib/dogapi/version.rb` to a dev version (e.g. `1.39.0` -> `1.40.0.dev`), open a PR and merge it to master.
46
+ 1. Bump the version again in `lib/dogapi/version.rb` to a dev version (e.g. `1.42.0` -> `1.42.1.dev`), open a PR and merge it to master.
@@ -28,10 +28,10 @@ module Capistrano
28
28
  @cap_version
29
29
  end
30
30
 
31
- def self.submit(api_key, use_getlogin=true)
31
+ def self.submit(api_key, use_getlogin=true, endpoint=nil)
32
32
  begin
33
33
  if api_key
34
- dog = Dogapi::Client.new(api_key)
34
+ dog = Dogapi::Client.new(api_key, nil, nil, nil, true, nil, endpoint, false)
35
35
  reporter.report(use_getlogin).each do |event, hosts|
36
36
  if hosts.size > 0
37
37
  hosts.each do |host|
@@ -63,9 +63,9 @@ module Capistrano
63
63
  desc 'Submit the tasks that have run to Datadog as events'
64
64
  task :submit do |ns|
65
65
  if variables[:use_getlogin].nil?
66
- Capistrano::Datadog.submit variables[:datadog_api_key]
66
+ Capistrano::Datadog.submit variables[:datadog_api_key], true, variables[:datadog_host]
67
67
  else
68
- Capistrano::Datadog.submit variables[:datadog_api_key], variables[:use_getlogin]
68
+ Capistrano::Datadog.submit variables[:datadog_api_key], variables[:use_getlogin], variables[:datadog_host]
69
69
  end
70
70
  end
71
71
  end
@@ -81,9 +81,10 @@ end
81
81
  at_exit do
82
82
  api_key = Capistrano::Configuration.env.fetch :datadog_api_key
83
83
  use_getlogin = Capistrano::Configuration.env.fetch :use_getlogin
84
+ datadog_host = Capistrano::Configuration.env.fetch :datadog_host
84
85
  if use_getlogin.nil?
85
- Capistrano::Datadog.submit api_key
86
+ Capistrano::Datadog.submit api_key, true, datadog_host
86
87
  else
87
- Capistrano::Datadog.submit api_key, use_getlogin
88
+ Capistrano::Datadog.submit api_key, use_getlogin, datadog_host
88
89
  end
89
90
  end
@@ -4,6 +4,7 @@
4
4
 
5
5
  require 'cgi'
6
6
  require 'net/https'
7
+ require 'rbconfig'
7
8
  require 'socket'
8
9
  require 'uri'
9
10
  require 'English'
@@ -13,7 +14,16 @@ require 'multi_json'
13
14
  require 'set'
14
15
  require 'open3'
15
16
 
17
+ require 'dogapi/version'
18
+
16
19
  module Dogapi
20
+ USER_AGENT = format(
21
+ 'dogapi-rb/%<version>s (ruby %<ruver>s; os %<os>s; arch %<arch>s)',
22
+ version: VERSION,
23
+ ruver: RUBY_VERSION,
24
+ os: RbConfig::CONFIG['host_os'].downcase,
25
+ arch: RbConfig::CONFIG['host_cpu']
26
+ )
17
27
 
18
28
  # Metadata class to hold the scope of an API call
19
29
  class Scope
@@ -76,11 +86,12 @@ module Dogapi
76
86
  # Superclass that deals with the details of communicating with the DataDog API
77
87
  class APIService
78
88
  attr_reader :api_key, :application_key
79
- def initialize(api_key, application_key, silent=true, timeout=nil, endpoint=nil)
89
+ def initialize(api_key, application_key, silent=true, timeout=nil, endpoint=nil, skip_ssl_validation=false)
80
90
  @api_key = api_key
81
91
  @application_key = application_key
82
92
  @api_host = endpoint || Dogapi.find_datadog_host()
83
93
  @silent = silent
94
+ @skip_ssl_validation = skip_ssl_validation
84
95
  @timeout = timeout || 5
85
96
  end
86
97
 
@@ -100,6 +111,9 @@ module Dogapi
100
111
  session = connection.new(uri.host, uri.port)
101
112
  session.open_timeout = @timeout
102
113
  session.use_ssl = uri.scheme == 'https'
114
+ if @skip_ssl_validation
115
+ session.verify_mode = OpenSSL::SSL::VERIFY_NONE
116
+ end
103
117
  session.start do |conn|
104
118
  conn.read_timeout = @timeout
105
119
  yield conn
@@ -138,11 +152,11 @@ module Dogapi
138
152
  def prepare_request(method, url, params, body, send_json, with_app_key)
139
153
  url_with_params = url + params
140
154
  req = method.new(url_with_params)
155
+ req['User-Agent'] = USER_AGENT
141
156
  unless should_set_api_and_app_keys_in_params?(url)
142
157
  req['DD-API-KEY'] = @api_key
143
158
  req['DD-APPLICATION-KEY'] = @application_key if with_app_key
144
159
  end
145
-
146
160
  if send_json
147
161
  req.content_type = 'application/json'
148
162
  req.body = MultiJson.dump(body)
@@ -169,7 +183,7 @@ module Dogapi
169
183
  end
170
184
 
171
185
  def handle_response(resp)
172
- if resp.code == 204 || resp.body == '' || resp.body == 'null' || resp.body.nil?
186
+ if resp.code.to_i == 204 || resp.body == '' || resp.body == 'null' || resp.body.nil?
173
187
  return resp.code, {}
174
188
  end
175
189
  begin
@@ -184,7 +198,7 @@ module Dogapi
184
198
  def handle_redirect(conn, req, resp, retries=10)
185
199
  req.uri = URI.parse(resp.header['location'])
186
200
  new_response = conn.request(req)
187
- if retries > 1 && new_response.code / 100 == 3
201
+ if retries > 1 && new_response.code.to_i / 100 == 3
188
202
  new_response = handle_redirect(conn, req, new_response, retries - 1)
189
203
  end
190
204
  new_response
@@ -200,14 +214,17 @@ module Dogapi
200
214
  @@hostname = nil
201
215
 
202
216
  def Dogapi.find_localhost
203
- unless @@hostname
204
- out, status = Open3.capture2('hostname', '-f', err: File::NULL)
205
- @@hostname = out.strip
206
- # Get status to check if the call was successful
207
- raise SystemCallError, 'Could not get hostname with `hostname -f`' unless status.exitstatus.zero?
208
- end
209
- rescue SystemCallError
210
- @@hostname = Addrinfo.getaddrinfo(Socket.gethostname, nil, nil, nil, nil, Socket::AI_CANONNAME).first.canonname
217
+ return @@hostname if @@hostname
218
+ out, status = Open3.capture2('hostname', '-f', err: File::NULL)
219
+ unless status.exitstatus.zero?
220
+ begin
221
+ out = Addrinfo.getaddrinfo(Socket.gethostname, nil, nil, nil, nil, Socket::AI_CANONNAME).first.canonname
222
+ rescue SocketError
223
+ out, status = Open3.capture2('hostname', err: File::NULL)
224
+ raise SystemCallError, 'Both `hostname` and `hostname -f` failed.' unless status.exitstatus.zero?
225
+ end
226
+ end
227
+ @@hostname = out.strip
211
228
  end
212
229
 
213
230
  def Dogapi.find_proxy
@@ -13,7 +13,8 @@ module Dogapi
13
13
  # See Dogapi::V2 for the thick underlying clients
14
14
  class ClientV2
15
15
  attr_accessor :datadog_host
16
- def initialize(api_key, application_key=nil, host=nil, device=nil, silent=true, timeout=nil, endpoint=nil)
16
+ def initialize(api_key, application_key=nil, host=nil, device=nil, silent=true,
17
+ timeout=nil, endpoint=nil, skip_ssl_validation=false)
17
18
 
18
19
  if api_key
19
20
  @api_key = api_key
@@ -27,7 +28,7 @@ module Dogapi
27
28
  @device = device
28
29
 
29
30
  @dashboard_list_service_v2 = Dogapi::V2::DashboardListService.new(
30
- @api_key, @application_key, silent, timeout, @datadog_host
31
+ @api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation
31
32
  )
32
33
 
33
34
  end
@@ -64,7 +65,7 @@ module Dogapi
64
65
  # Support for API version 2.
65
66
 
66
67
  # rubocop:disable Metrics/MethodLength, Metrics/LineLength
67
- def initialize(api_key, application_key=nil, host=nil, device=nil, silent=true, timeout=nil, endpoint=nil)
68
+ def initialize(api_key, application_key=nil, host=nil, device=nil, silent=true, timeout=nil, endpoint=nil, skip_ssl_validation=false)
68
69
 
69
70
  if api_key
70
71
  @api_key = api_key
@@ -78,38 +79,39 @@ module Dogapi
78
79
  @device = device
79
80
 
80
81
  # FIXME: refactor to avoid all this code duplication
81
- @metric_svc = Dogapi::V1::MetricService.new(@api_key, @application_key, silent, timeout, @datadog_host)
82
- @event_svc = Dogapi::V1::EventService.new(@api_key, @application_key, silent, timeout, @datadog_host)
83
- @tag_svc = Dogapi::V1::TagService.new(@api_key, @application_key, silent, timeout, @datadog_host)
84
- @comment_svc = Dogapi::V1::CommentService.new(@api_key, @application_key, silent, timeout, @datadog_host)
85
- @search_svc = Dogapi::V1::SearchService.new(@api_key, @application_key, silent, timeout, @datadog_host)
86
- @dash_service = Dogapi::V1::DashService.new(@api_key, @application_key, silent, timeout, @datadog_host)
87
- @dashboard_service = Dogapi::V1::DashboardService.new(@api_key, @application_key, silent, timeout, @datadog_host)
82
+ @metric_svc = Dogapi::V1::MetricService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
83
+ @event_svc = Dogapi::V1::EventService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
84
+ @tag_svc = Dogapi::V1::TagService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
85
+ @comment_svc = Dogapi::V1::CommentService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
86
+ @search_svc = Dogapi::V1::SearchService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
87
+ @dash_service = Dogapi::V1::DashService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
88
+ @dashboard_service = Dogapi::V1::DashboardService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
88
89
  @dashboard_list_service = Dogapi::V1::DashboardListService.new(
89
- @api_key, @application_key, silent, timeout, @datadog_host
90
+ @api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation
90
91
  )
91
- @alert_svc = Dogapi::V1::AlertService.new(@api_key, @application_key, silent, timeout, @datadog_host)
92
- @user_svc = Dogapi::V1::UserService.new(@api_key, @application_key, silent, timeout, @datadog_host)
93
- @snapshot_svc = Dogapi::V1::SnapshotService.new(@api_key, @application_key, silent, timeout, @datadog_host)
94
- @embed_svc = Dogapi::V1::EmbedService.new(@api_key, @application_key, silent, timeout, @datadog_host)
95
- @screenboard_svc = Dogapi::V1::ScreenboardService.new(@api_key, @application_key, silent, timeout, @datadog_host)
96
- @monitor_svc = Dogapi::V1::MonitorService.new(@api_key, @application_key, silent, timeout, @datadog_host)
97
- @synthetics_svc = Dogapi::V1::SyntheticsService.new(@api_key, @application_key, silent, timeout, @datadog_host)
98
- @service_check_svc = Dogapi::V1::ServiceCheckService.new(@api_key, @application_key, silent, timeout, @datadog_host)
99
- @metadata_svc = Dogapi::V1::MetadataService.new(@api_key, @application_key, silent, timeout, @datadog_host)
92
+ @alert_svc = Dogapi::V1::AlertService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
93
+ @user_svc = Dogapi::V1::UserService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
94
+ @snapshot_svc = Dogapi::V1::SnapshotService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
95
+ @embed_svc = Dogapi::V1::EmbedService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
96
+ @screenboard_svc = Dogapi::V1::ScreenboardService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
97
+ @monitor_svc = Dogapi::V1::MonitorService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
98
+ @synthetics_svc = Dogapi::V1::SyntheticsService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
99
+ @service_check_svc = Dogapi::V1::ServiceCheckService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
100
+ @metadata_svc = Dogapi::V1::MetadataService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
100
101
  @legacy_event_svc = Dogapi::EventService.new(@datadog_host)
101
- @hosts_svc = Dogapi::V1::HostsService.new(@api_key, @application_key, silent, timeout, @datadog_host)
102
- @integration_svc = Dogapi::V1::IntegrationService.new(@api_key, @application_key, silent, timeout, @datadog_host)
103
- @aws_integration_svc = Dogapi::V1::AwsIntegrationService.new(@api_key, @application_key, silent, timeout, @datadog_host)
104
- @aws_logs_svc = Dogapi::V1::AwsLogsService.new(@api_key, @application_key, silent, timeout, @datadog_host)
105
- @usage_svc = Dogapi::V1::UsageService.new(@api_key, @application_key, silent, timeout, @datadog_host)
106
- @azure_integration_svc = Dogapi::V1::AzureIntegrationService.new(@api_key, @application_key, silent, timeout, @datadog_host)
107
- @gcp_integration_svc = Dogapi::V1::GcpIntegrationService.new(@api_key, @application_key, silent, timeout, @datadog_host)
102
+ @hosts_svc = Dogapi::V1::HostsService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
103
+ @integration_svc = Dogapi::V1::IntegrationService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
104
+ @aws_integration_svc = Dogapi::V1::AwsIntegrationService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
105
+ @aws_logs_svc = Dogapi::V1::AwsLogsService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
106
+ @usage_svc = Dogapi::V1::UsageService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
107
+ @azure_integration_svc = Dogapi::V1::AzureIntegrationService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
108
+ @gcp_integration_svc = Dogapi::V1::GcpIntegrationService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
108
109
  @service_level_objective_svc = Dogapi::V1::ServiceLevelObjectiveService.new(@api_key, @application_key, silent,
109
- timeout, @datadog_host)
110
+ timeout, @datadog_host, skip_ssl_validation)
111
+ @logs_pipeline_svc = Dogapi::V1::LogsPipelineService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
110
112
 
111
113
  # Support for Dashboard List API v2.
112
- @v2 = Dogapi::ClientV2.new(@api_key, @application_key, true, true, @datadog_host)
114
+ @v2 = Dogapi::ClientV2.new(@api_key, @application_key, true, true, @datadog_host, skip_ssl_validation)
113
115
 
114
116
  end
115
117
  # rubocop:enable Metrics/MethodLength, Metrics/LineLength
@@ -716,6 +718,30 @@ module Dogapi
716
718
  @service_level_objective_svc.delete_timeframes_service_level_objective(ops)
717
719
  end
718
720
 
721
+ #
722
+ # LOGS PIPELINES
723
+ #
724
+
725
+ def create_logs_pipeline(name, filter, options = {})
726
+ @logs_pipeline_svc.create_logs_pipeline(name, filter, options)
727
+ end
728
+
729
+ def get_logs_pipeline(pipeline_id)
730
+ @logs_pipeline_svc.get_logs_pipeline(pipeline_id)
731
+ end
732
+
733
+ def get_all_logs_pipelines
734
+ @logs_pipeline_svc.get_all_logs_pipelines
735
+ end
736
+
737
+ def update_logs_pipeline(pipeline_id, name, filter, options = {})
738
+ @logs_pipeline_svc.update_logs_pipeline(pipeline_id, name, filter, options)
739
+ end
740
+
741
+ def delete_logs_pipeline(pipeline_id)
742
+ @logs_pipeline_svc.delete_logs_pipeline(pipeline_id)
743
+ end
744
+
719
745
  #
720
746
  # SERVICE CHECKS
721
747
  #
@@ -9,6 +9,7 @@ require 'dogapi/v1/dashboard'
9
9
  require 'dogapi/v1/dashboard_list'
10
10
  require 'dogapi/v1/embed'
11
11
  require 'dogapi/v1/event'
12
+ require 'dogapi/v1/logs_pipeline'
12
13
  require 'dogapi/v1/metadata'
13
14
  require 'dogapi/v1/metric'
14
15
  require 'dogapi/v1/monitor'
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -28,6 +26,11 @@ module Dogapi
28
26
  # e.g. '["user1@domain.com", "user2@domain.com"]'
29
27
  # :template_variables => JSON: List of template variables for this dashboard.
30
28
  # e.g. [{"name": "host", "prefix": "host", "default": "my-host"}]
29
+ # :template_variable_presets => JSON: List of template variables saved views
30
+ # e.g. {
31
+ # "name": "my_template_variable_preset",
32
+ # "template_variables": [{"name": "host", "prefix": "host", "default": "my-host"}]
33
+ # }
31
34
  def create_board(title, widgets, layout_type, options)
32
35
  # Required arguments
33
36
  body = {
@@ -40,6 +43,7 @@ module Dogapi
40
43
  body[:is_read_only] = options[:is_read_only] if options[:is_read_only]
41
44
  body[:notify_list] = options[:notify_list] if options[:notify_list]
42
45
  body[:template_variables] = options[:template_variables] if options[:template_variables]
46
+ body[:template_variable_presets] = options[:template_variable_presets] if options[:template_variable_presets]
43
47
 
44
48
  request(Net::HTTP::Post, "/api/#{API_VERSION}/#{RESOURCE_NAME}", nil, body, true)
45
49
  end
@@ -60,6 +64,11 @@ module Dogapi
60
64
  # e.g. '["user1@domain.com", "user2@domain.com"]'
61
65
  # :template_variables => JSON: List of template variables for this dashboard.
62
66
  # e.g. [{"name": "host", "prefix": "host", "default": "my-host"}]
67
+ # :template_variable_presets => JSON: List of template variables saved views
68
+ # e.g. {
69
+ # "name": "my_template_variable_preset",
70
+ # "template_variables": [{"name": "host", "prefix": "host", "default": "my-host"}]
71
+ # }
63
72
  def update_board(dashboard_id, title, widgets, layout_type, options)
64
73
  # Required arguments
65
74
  body = {
@@ -72,6 +81,7 @@ module Dogapi
72
81
  body[:is_read_only] = options[:is_read_only] if options[:is_read_only]
73
82
  body[:notify_list] = options[:notify_list] if options[:notify_list]
74
83
  body[:template_variables] = options[:template_variables] if options[:template_variables]
84
+ body[:template_variable_presets] = options[:template_variable_presets] if options[:template_variable_presets]
75
85
 
76
86
  request(Net::HTTP::Put, "/api/#{API_VERSION}/#{RESOURCE_NAME}/#{dashboard_id}", nil, body, true)
77
87
  end
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -0,0 +1,41 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
5
+ module Dogapi
6
+ class V1 # for namespacing
7
+ class LogsPipelineService < Dogapi::APIService
8
+ API_VERSION = 'v1'
9
+
10
+ def create_logs_pipeline(name, filter, options = {})
11
+ body = {
12
+ 'name' => name,
13
+ 'filter' => filter
14
+ }.merge options
15
+
16
+ request(Net::HTTP::Post, "/api/#{API_VERSION}/logs/config/pipelines", nil, body, true)
17
+ end
18
+
19
+ def get_logs_pipeline(pipeline_id)
20
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/logs/config/pipelines/#{pipeline_id}", nil, nil, false)
21
+ end
22
+
23
+ def get_all_logs_pipelines
24
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/logs/config/pipelines", nil, nil, false)
25
+ end
26
+
27
+ def update_logs_pipeline(pipeline_id, name, filter, options = {})
28
+ body = {
29
+ 'name' => name,
30
+ 'filter' => filter
31
+ }.merge options
32
+
33
+ request(Net::HTTP::Put, "/api/#{API_VERSION}/logs/config/pipelines/#{pipeline_id}", nil, body, true)
34
+ end
35
+
36
+ def delete_logs_pipeline(pipeline_id)
37
+ request(Net::HTTP::Delete, "/api/#{API_VERSION}/logs/config/pipelines/#{pipeline_id}", nil, nil, false)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
  class MonitorService < Dogapi::APIService
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1
9
7
 
@@ -1,4 +1,6 @@
1
- require 'dogapi'
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
2
4
 
3
5
  module Dogapi
4
6
  class V1 # for namespacing
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -1,4 +1,6 @@
1
- require 'dogapi'
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
2
4
 
3
5
  module Dogapi
4
6
  class V1 # for namespacing
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V1 # for namespacing
9
7
 
@@ -2,8 +2,6 @@
2
2
  # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
- require 'dogapi'
6
-
7
5
  module Dogapi
8
6
  class V2 # for namespacing
9
7
 
@@ -3,5 +3,5 @@
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
5
  module Dogapi
6
- VERSION = '1.40.0'
6
+ VERSION = '1.45.0'
7
7
  end
@@ -26,6 +26,15 @@ describe Dogapi::Client do
26
26
  'prefix' => 'host',
27
27
  'default' => 'my-host'
28
28
  }].freeze
29
+ TEMPLATE_VARIABLE_PRESETS = [{
30
+ 'name' => 'preset1',
31
+ 'template_variables' => [
32
+ {
33
+ 'name' => 'host1',
34
+ 'value' => 'my-host'
35
+ }
36
+ ]
37
+ }].freeze
29
38
 
30
39
  REQUIRED_ARGS = {
31
40
  title: TITLE,
@@ -37,7 +46,8 @@ describe Dogapi::Client do
37
46
  description: DESCRIPTION,
38
47
  is_read_only: IS_READ_ONLY,
39
48
  notify_list: NOTIFY_LIST,
40
- template_variables: TEMPLATE_VARIABLES
49
+ template_variables: TEMPLATE_VARIABLES,
50
+ template_variable_presets: TEMPLATE_VARIABLE_PRESETS
41
51
  }
42
52
  DASHBOARD_ARGS = REQUIRED_ARGS.values + [OPTIONS]
43
53
  DASHBOARD_PAYLOAD = REQUIRED_ARGS.merge(OPTIONS)
@@ -0,0 +1,43 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
5
+ require_relative '../spec_helper'
6
+
7
+ describe Dogapi::Client do
8
+ LOGS_PIPELINE_ID = '42'
9
+ LOGS_PIPELINE_NAME = 'my logs pipeline'.freeze
10
+ LOGS_PIPELINE_FILTER = { 'query' => 'source:my-app' }.freeze
11
+
12
+ describe '#create_logs_pipeline' do
13
+ it_behaves_like 'an api method with options',
14
+ :create_logs_pipeline, [LOGS_PIPELINE_NAME, LOGS_PIPELINE_FILTER],
15
+ :post, '/logs/config/pipelines', 'name' => LOGS_PIPELINE_NAME,
16
+ 'filter' => LOGS_PIPELINE_FILTER
17
+ end
18
+
19
+ describe '#get_logs_pipeline' do
20
+ it_behaves_like 'an api method',
21
+ :get_logs_pipeline, [LOGS_PIPELINE_ID],
22
+ :get, "/logs/config/pipelines/#{LOGS_PIPELINE_ID}"
23
+ end
24
+
25
+ describe '#get_all_logs_pipelines' do
26
+ it_behaves_like 'an api method',
27
+ :get_all_logs_pipelines, [],
28
+ :get, '/logs/config/pipelines'
29
+ end
30
+
31
+ describe '#update_logs_pipeline' do
32
+ it_behaves_like 'an api method with options',
33
+ :update_logs_pipeline, [LOGS_PIPELINE_ID, LOGS_PIPELINE_NAME, LOGS_PIPELINE_FILTER],
34
+ :put, "/logs/config/pipelines/#{LOGS_PIPELINE_ID}", 'name' => LOGS_PIPELINE_NAME,
35
+ 'filter' => LOGS_PIPELINE_FILTER
36
+ end
37
+
38
+ describe '#delete_logs_pipeline' do
39
+ it_behaves_like 'an api method',
40
+ :delete_logs_pipeline, [LOGS_PIPELINE_ID],
41
+ :delete, "/logs/config/pipelines/#{LOGS_PIPELINE_ID}"
42
+ end
43
+ end
@@ -10,7 +10,19 @@ SimpleCov.start do
10
10
  add_filter 'spec'
11
11
  end
12
12
 
13
- WebMock.disable_net_connect!(allow_localhost: false)
13
+ webmock_allow = []
14
+
15
+ begin
16
+ require 'ddtrace'
17
+ Datadog.configure do |c|
18
+ c.use :rspec, service_name: 'dogapi-rb'
19
+ end
20
+ webmock_allow << "#{Datadog::Transport::HTTP.default_hostname}:#{Datadog::Transport::HTTP.default_port}"
21
+ rescue LoadError
22
+ puts 'ddtrace gem not found'
23
+ end
24
+
25
+ WebMock.disable_net_connect!(allow_localhost: false, allow: webmock_allow)
14
26
 
15
27
  # include our code and methods
16
28
  require 'dogapi'
@@ -134,6 +134,15 @@ describe 'Common' do
134
134
  expect(req['DD-APPLICATION-KEY']).to eq service.application_key
135
135
  end
136
136
  end
137
+
138
+ it 'properly sets User-Agent header' do
139
+ service = Dogapi::APIService.new('api_key', 'app_key', true, nil, 'https://app.example.com')
140
+ params = service.prepare_params(nil, '/api/v1/validate', true)
141
+ req = service.prepare_request(Net::HTTP::Get, '/api/v1/validate', params, nil, false, true)
142
+
143
+ expect(req.key?('User-Agent')).to be true
144
+ expect(req['User-Agent']).to match(%r{dogapi-rb\/[^\s]+ \(ruby [^\s]+; os [^\s]+; arch [^\s]+\)})
145
+ end
137
146
  end
138
147
  end
139
148
 
@@ -173,21 +182,21 @@ describe Dogapi::APIService do
173
182
  context 'when receiving a correct reponse with valid json' do
174
183
  it 'parses it and return code and parsed body' do
175
184
  dog = dogapi_service
176
- resp = FakeResponse.new 202, '{"test2": "test3"}'
177
- expect(dog.handle_response(resp)).to eq([202, { 'test2' => 'test3' }])
185
+ resp = FakeResponse.new '202', '{"test2": "test3"}'
186
+ expect(dog.handle_response(resp)).to eq(['202', { 'test2' => 'test3' }])
178
187
  end
179
188
  end
180
189
  context 'when receiving a response with invalid json' do
181
190
  it 'raises an error' do
182
191
  dog = dogapi_service
183
- resp = FakeResponse.new 202, "{'test2': }"
192
+ resp = FakeResponse.new '202', "{'test2': }"
184
193
  expect { dog.handle_response(resp) }.to raise_error(RuntimeError, "Invalid JSON Response: {'test2': }")
185
194
  end
186
195
  end
187
196
  context 'when receiving a non json response' do
188
197
  it 'raises an error indicating the response Content-Type' do
189
198
  dog = dogapi_service
190
- resp = FakeResponse.new 202, '<html><body><h1>403 Forbidden</h1>', 'text/html'
199
+ resp = FakeResponse.new '202', '<html><body><h1>403 Forbidden</h1>', 'text/html'
191
200
  msg = 'Response Content-Type is not application/json but is text/html: <html><body><h1>403 Forbidden</h1>'
192
201
  expect { dog.handle_response(resp) }.to raise_error(RuntimeError, msg)
193
202
  end
@@ -195,12 +204,12 @@ describe Dogapi::APIService do
195
204
  context 'when receiving a bad response' do
196
205
  it 'returns the error code and an empty body' do
197
206
  dog = dogapi_service
198
- resp = FakeResponse.new 204, ''
199
- expect(dog.handle_response(resp)).to eq([204, {}])
200
- resp = FakeResponse.new 202, nil
201
- expect(dog.handle_response(resp)).to eq([202, {}])
202
- resp = FakeResponse.new 202, 'null'
203
- expect(dog.handle_response(resp)).to eq([202, {}])
207
+ resp = FakeResponse.new '204', ''
208
+ expect(dog.handle_response(resp)).to eq(['204', {}])
209
+ resp = FakeResponse.new '202', nil
210
+ expect(dog.handle_response(resp)).to eq(['202', {}])
211
+ resp = FakeResponse.new '202', 'null'
212
+ expect(dog.handle_response(resp)).to eq(['202', {}])
204
213
  end
205
214
  end
206
215
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dogapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.40.0
4
+ version: 1.45.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-06 00:00:00.000000000 Z
11
+ date: 2021-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -125,6 +125,7 @@ files:
125
125
  - lib/dogapi/v1/gcp_integration.rb
126
126
  - lib/dogapi/v1/hosts.rb
127
127
  - lib/dogapi/v1/integration.rb
128
+ - lib/dogapi/v1/logs_pipeline.rb
128
129
  - lib/dogapi/v1/metadata.rb
129
130
  - lib/dogapi/v1/metric.rb
130
131
  - lib/dogapi/v1/monitor.rb
@@ -153,6 +154,7 @@ files:
153
154
  - spec/integration/event_spec.rb
154
155
  - spec/integration/gcp_integration_spec.rb
155
156
  - spec/integration/integration_spec.rb
157
+ - spec/integration/logs_pipeline_spec.rb
156
158
  - spec/integration/metadata_spec.rb
157
159
  - spec/integration/metric_spec.rb
158
160
  - spec/integration/monitor_spec.rb
@@ -177,7 +179,7 @@ metadata:
177
179
  changelog_uri: https://github.com/DataDog/dogapi-rb/blob/master/CHANGELOG.md
178
180
  documentation_uri: https://docs.datadoghq.com/api/
179
181
  source_code_uri: https://github.com/DataDog/dogapi-rb
180
- post_install_message:
182
+ post_install_message:
181
183
  rdoc_options:
182
184
  - "--title"
183
185
  - DogAPI -- Datadog Client
@@ -199,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
201
  version: '0'
200
202
  requirements: []
201
203
  rubygems_version: 3.0.6
202
- signing_key:
204
+ signing_key:
203
205
  specification_version: 4
204
206
  summary: Ruby bindings for Datadog's API
205
207
  test_files:
@@ -216,6 +218,7 @@ test_files:
216
218
  - spec/integration/event_spec.rb
217
219
  - spec/integration/gcp_integration_spec.rb
218
220
  - spec/integration/integration_spec.rb
221
+ - spec/integration/logs_pipeline_spec.rb
219
222
  - spec/integration/metadata_spec.rb
220
223
  - spec/integration/metric_spec.rb
221
224
  - spec/integration/monitor_spec.rb