dogapi 1.37.0 → 1.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.azure-pipelines/all.yml +16 -7
  3. data/.github/CODEOWNERS +10 -0
  4. data/.github/ISSUE_TEMPLATE/bug_report.md +36 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
  6. data/.github/PULL_REQUEST_TEMPLATE.md +77 -0
  7. data/.github/labeler.yml +5 -0
  8. data/.github/workflows/labeler.yml +11 -0
  9. data/.github/workflows/stale.yml +39 -0
  10. data/.rubocop_todo.yml +44 -75
  11. data/CHANGELOG.md +39 -1
  12. data/CONTRIBUTING.md +111 -0
  13. data/DEVELOPMENT.md +11 -0
  14. data/Gemfile +2 -0
  15. data/Gemfile_1.9 +13 -0
  16. data/LICENSE +21 -20
  17. data/LICENSE-3rdparty.csv +6 -0
  18. data/README.rdoc +14 -0
  19. data/RELEASING.md +46 -0
  20. data/SUPPORT.md +9 -0
  21. data/dogapi.gemspec +2 -0
  22. data/examples/custom_metric.rb +1 -1
  23. data/lib/capistrano/README.md +4 -1
  24. data/lib/capistrano/datadog.rb +8 -4
  25. data/lib/capistrano/datadog/v2.rb +9 -1
  26. data/lib/capistrano/datadog/v3.rb +10 -1
  27. data/lib/dogapi.rb +4 -0
  28. data/lib/dogapi/common.rb +90 -35
  29. data/lib/dogapi/event.rb +4 -0
  30. data/lib/dogapi/facade.rb +176 -28
  31. data/lib/dogapi/metric.rb +4 -0
  32. data/lib/dogapi/v1.rb +9 -0
  33. data/lib/dogapi/v1/alert.rb +4 -0
  34. data/lib/dogapi/v1/aws_integration.rb +117 -0
  35. data/lib/dogapi/v1/aws_logs.rb +107 -0
  36. data/lib/dogapi/v1/azure_integration.rb +85 -0
  37. data/lib/dogapi/v1/comment.rb +4 -0
  38. data/lib/dogapi/v1/dash.rb +10 -4
  39. data/lib/dogapi/v1/dashboard.rb +4 -0
  40. data/lib/dogapi/v1/dashboard_list.rb +4 -0
  41. data/lib/dogapi/v1/embed.rb +4 -0
  42. data/lib/dogapi/v1/event.rb +4 -0
  43. data/lib/dogapi/v1/gcp_integration.rb +76 -0
  44. data/lib/dogapi/v1/hosts.rb +4 -0
  45. data/lib/dogapi/v1/integration.rb +4 -0
  46. data/lib/dogapi/v1/metadata.rb +4 -0
  47. data/lib/dogapi/v1/metric.rb +4 -0
  48. data/lib/dogapi/v1/monitor.rb +20 -7
  49. data/lib/dogapi/v1/screenboard.rb +4 -0
  50. data/lib/dogapi/v1/search.rb +4 -0
  51. data/lib/dogapi/v1/service_check.rb +4 -0
  52. data/lib/dogapi/v1/service_level_objective.rb +31 -35
  53. data/lib/dogapi/v1/snapshot.rb +4 -0
  54. data/lib/dogapi/v1/synthetics.rb +80 -0
  55. data/lib/dogapi/v1/tag.rb +4 -0
  56. data/lib/dogapi/v1/usage.rb +4 -0
  57. data/lib/dogapi/v1/user.rb +4 -0
  58. data/lib/dogapi/v2.rb +4 -0
  59. data/lib/dogapi/v2/dashboard_list.rb +4 -0
  60. data/lib/dogapi/version.rb +5 -1
  61. data/spec/integration/alert_spec.rb +4 -0
  62. data/spec/integration/aws_integration_spec.rb +55 -0
  63. data/spec/integration/aws_logs_spec.rb +59 -0
  64. data/spec/integration/azure_integration_spec.rb +63 -0
  65. data/spec/integration/comment_spec.rb +5 -0
  66. data/spec/integration/common_spec.rb +4 -0
  67. data/spec/integration/dash_spec.rb +7 -1
  68. data/spec/integration/dashboard_list_spec.rb +4 -0
  69. data/spec/integration/dashboard_spec.rb +4 -0
  70. data/spec/integration/embed_spec.rb +4 -0
  71. data/spec/integration/event_spec.rb +5 -0
  72. data/spec/integration/gcp_integration_spec.rb +57 -0
  73. data/spec/integration/integration_spec.rb +4 -0
  74. data/spec/integration/metadata_spec.rb +4 -0
  75. data/spec/integration/metric_spec.rb +4 -0
  76. data/spec/integration/monitor_spec.rb +30 -1
  77. data/spec/integration/screenboard_spec.rb +4 -0
  78. data/spec/integration/search_spec.rb +4 -0
  79. data/spec/integration/service_check_spec.rb +4 -0
  80. data/spec/integration/service_level_objective_spec.rb +13 -11
  81. data/spec/integration/snapshot_spec.rb +4 -0
  82. data/spec/integration/synthetics_spec.rb +131 -0
  83. data/spec/integration/tag_spec.rb +4 -0
  84. data/spec/integration/usage_spec.rb +4 -0
  85. data/spec/integration/user_spec.rb +4 -0
  86. data/spec/spec_helper.rb +12 -21
  87. data/spec/unit/capistrano_spec.rb +4 -0
  88. data/spec/unit/common_spec.rb +64 -7
  89. data/spec/unit/facade_spec.rb +4 -0
  90. metadata +31 -4
@@ -1,3 +1,7 @@
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
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -1,3 +1,7 @@
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
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -1,3 +1,7 @@
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
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -1,3 +1,7 @@
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
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -1,10 +1,12 @@
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
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
4
8
  class V1 # for namespacing
5
-
6
9
  class MonitorService < Dogapi::APIService
7
-
8
10
  API_VERSION = 'v1'
9
11
 
10
12
  def monitor(type, query, options = {})
@@ -42,8 +44,19 @@ module Dogapi
42
44
  request(Net::HTTP::Get, "/api/#{API_VERSION}/monitor/#{monitor_id}", extra_params, nil, false)
43
45
  end
44
46
 
45
- def delete_monitor(monitor_id)
46
- request(Net::HTTP::Delete, "/api/#{API_VERSION}/monitor/#{monitor_id}", nil, nil, false)
47
+ def can_delete_monitors(monitor_ids)
48
+ extra_params =
49
+ if monitor_ids.respond_to?(:join)
50
+ { "monitor_ids" => monitor_ids.join(",") }
51
+ else
52
+ { "monitor_ids" => monitor_ids }
53
+ end
54
+
55
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/monitor/can_delete", extra_params, nil, false)
56
+ end
57
+
58
+ def delete_monitor(monitor_id, options = {})
59
+ request(Net::HTTP::Delete, "/api/#{API_VERSION}/monitor/#{monitor_id}", options, nil, false)
47
60
  end
48
61
 
49
62
  def get_all_monitors(options = {})
@@ -122,8 +135,8 @@ module Dogapi
122
135
  request(Net::HTTP::Put, "/api/#{API_VERSION}/downtime/#{downtime_id}", nil, options, true)
123
136
  end
124
137
 
125
- def get_downtime(downtime_id)
126
- request(Net::HTTP::Get, "/api/#{API_VERSION}/downtime/#{downtime_id}", nil, nil, false)
138
+ def get_downtime(downtime_id, options = {})
139
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/downtime/#{downtime_id}", options, nil, false)
127
140
  end
128
141
 
129
142
  def cancel_downtime(downtime_id)
@@ -131,7 +144,7 @@ module Dogapi
131
144
  end
132
145
 
133
146
  def cancel_downtime_by_scope(scope)
134
- request(Net::HTTP::Post, "/api/#{API_VERSION}/downtime/cancel/by_scope", nil, { 'scope' => scope }, false)
147
+ request(Net::HTTP::Post, "/api/#{API_VERSION}/downtime/cancel/by_scope", nil, { 'scope' => scope }, true)
135
148
  end
136
149
 
137
150
  def get_all_downtimes(options = {})
@@ -1,3 +1,7 @@
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
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -1,3 +1,7 @@
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
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -1,3 +1,7 @@
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
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -8,55 +8,51 @@ module Dogapi
8
8
 
9
9
  API_VERSION = 'v1'
10
10
 
11
- def create_service_level_objective(type: , name: , description: nil, tags: nil, thresholds: nil,
12
- numerator: nil, denominator: nil, monitor_ids: nil, monitor_search: nil,
13
- groups: nil)
11
+ def create_service_level_objective(type, slo_name, thresholds, options = {})
14
12
  body = {
15
13
  type: type,
16
- name: name,
14
+ name: slo_name,
17
15
  thresholds: thresholds
18
16
  }
19
- if type == 'metric'
17
+
18
+ symbolized_options = Dogapi.symbolized_access(options)
19
+ if type.to_s == 'metric'
20
20
  body[:query] = {
21
- numerator: numerator,
22
- denominator: denominator
21
+ numerator: symbolized_options[:numerator],
22
+ denominator: symbolized_options[:denominator]
23
23
  }
24
24
  else
25
- body[:monitor_search] = monitor_search unless monitor_search.nil?
26
- body[:monitor_ids] = monitor_ids unless monitor_ids.nil?
27
- body[:groups] = groups unless groups.nil?
25
+ body[:monitor_search] = symbolized_options[:monitor_search] if symbolized_options[:monitor_search]
26
+ body[:monitor_ids] = symbolized_options[:monitor_ids] if symbolized_options[:monitor_ids]
27
+ body[:groups] = symbolized_options[:groups] if symbolized_options[:groups]
28
28
  end
29
- body[:tags] = tags unless tags.nil?
30
- body[:description] = description unless description.nil?
29
+ body[:tags] = symbolized_options[:tags] if symbolized_options[:tags]
30
+ body[:description] = symbolized_options[:description] if symbolized_options[:description]
31
31
 
32
32
  request(Net::HTTP::Post, "/api/#{API_VERSION}/slo", nil, body, true)
33
33
  end
34
34
 
35
- def update_service_level_objective(slo_id: , type: , name: nil, description: nil, tags: nil,
36
- thresholds: nil, numerator: nil, denominator: nil, monitor_ids: nil,
37
- monitor_search: nil, groups: nil)
35
+ def update_service_level_objective(slo_id, type, options = {})
38
36
  body = {
39
37
  type: type
40
38
  }
41
39
 
42
- body[:name] = name unless name.nil?
43
-
44
- body[:thresholds] = thresholds unless thresholds.nil?
45
-
40
+ symbolized_options = Dogapi.symbolized_access(options)
46
41
  if type == 'metric'
47
- if !numerator.nil? && !denominator.nil?
42
+ if symbolized_options[:numerator] && symbolized_options[:denominator]
48
43
  body[:query] = {
49
- numerator: numerator,
50
- denominator: denominator
44
+ numerator: symbolized_options[:numerator],
45
+ denominator: symbolized_options[:denominator]
51
46
  }
52
47
  end
53
48
  else
54
- body[:monitor_search] = monitor_search unless monitor_search.nil?
55
- body[:monitor_ids] = monitor_ids unless monitor_ids.nil?
56
- body[:groups] = groups unless groups.nil?
49
+ body[:monitor_search] = symbolized_options[:monitor_search] if symbolized_options[:monitor_search]
50
+ body[:monitor_ids] = symbolized_options[:monitor_ids] if symbolized_options[:monitor_ids]
51
+ body[:groups] = symbolized_options[:groups] if symbolized_options[:groups]
52
+ end
53
+ [:name, :thresholds, :tags, :description].each do |a|
54
+ body[a] = symbolized_options[a] if symbolized_options[a]
57
55
  end
58
- body[:tags] = tags unless tags.nil?
59
- body[:description] = description unless description.nil?
60
56
 
61
57
  request(Net::HTTP::Put, "/api/#{API_VERSION}/slo/#{slo_id}", nil, body, true)
62
58
  end
@@ -65,7 +61,7 @@ module Dogapi
65
61
  request(Net::HTTP::Get, "/api/#{API_VERSION}/slo/#{slo_id}", nil, nil, false)
66
62
  end
67
63
 
68
- def search_service_level_objective(slo_ids: nil, query: nil, offset: nil, limit: nil)
64
+ def search_service_level_objective(slo_ids, query, offset, limit)
69
65
  params = {}
70
66
  params[:offset] = offset unless offset.nil?
71
67
  params[:limit] = limit unless limit.nil?
@@ -96,19 +92,19 @@ module Dogapi
96
92
 
97
93
  def get_service_level_objective_history(slo_id, from_ts, to_ts)
98
94
  params = {
99
- from_ts: from_ts,
100
- to_ts: to_ts
95
+ from_ts: from_ts,
96
+ to_ts: to_ts
101
97
  }
102
98
  request(Net::HTTP::Get, "/api/#{API_VERSION}/slo/#{slo_id}/history", params, nil, false)
103
99
  end
104
100
 
105
101
  def can_delete_service_level_objective(slo_ids)
106
102
  params = {}
107
- if slo_ids.is_a?Array
108
- params[:ids] = slo_ids.join(',')
109
- else
110
- params[:ids] = slo_ids
111
- end
103
+ params[:ids] = if slo_ids.is_a? Array
104
+ slo_ids.join(',')
105
+ else
106
+ slo_ids
107
+ end
112
108
  request(Net::HTTP::Get, "/api/#{API_VERSION}/slo/can_delete", params, nil, false)
113
109
  end
114
110
 
@@ -1,3 +1,7 @@
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
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -0,0 +1,80 @@
1
+ require 'dogapi'
2
+
3
+ module Dogapi
4
+ class V1 # for namespacing
5
+ # SyntheticsService is the class responsible for dealing with the synthetics
6
+ class SyntheticsService < Dogapi::APIService
7
+
8
+ API_VERSION = 'v1'
9
+
10
+ # Create a synthetics test: POST /v1/synthetics/tests/
11
+ def create_synthetics_test(type, config, options = {})
12
+ body = {
13
+ 'type' => type,
14
+ 'config' => config
15
+ }.merge(options)
16
+
17
+ request(Net::HTTP::Post, "/api/#{API_VERSION}/synthetics/tests", nil, body, true)
18
+ end
19
+
20
+ # Edit a synthetics test: PUT /v1/synthetics/tests/<SYNTHETICS_TEST_PUBLIC_ID>
21
+ def update_synthetics_test(test_id, type, config, options = {})
22
+ body = {
23
+ 'type' => type,
24
+ 'config' => config
25
+ }.merge(options)
26
+
27
+ request(Net::HTTP::Put, "/api/#{API_VERSION}/synthetics/tests/#{test_id}", nil, body, true)
28
+ end
29
+
30
+ # Delete synthetics tests
31
+ def delete_synthetics_tests(test_ids)
32
+ body = {
33
+ 'public_ids' => test_ids
34
+ }
35
+ request(Net::HTTP::Post, "/api/#{API_VERSION}/synthetics/tests/delete", nil, body, true)
36
+ end
37
+
38
+ # Start of pause a synthetics test: POST /v1/synthetics/tests/<SYNTHETICS_TEST_PUBLIC_ID>/status
39
+ def start_pause_synthetics_test(test_id, new_status)
40
+ body = {
41
+ 'new_status' => new_status
42
+ }
43
+ request(Net::HTTP::Put, "/api/#{API_VERSION}/synthetics/tests/#{test_id}/status", nil, body, true)
44
+ end
45
+
46
+ # Get all synthetics tests: GET /v1/synthetics/tests
47
+ def get_all_synthetics_tests
48
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/synthetics/tests", nil, nil, false)
49
+ end
50
+
51
+ # Get info on a synthetics test: GET /v1/synthetics/tests/<SYNTHETICS_TEST_PUBLIC_ID>
52
+ def get_synthetics_test(test_id)
53
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/synthetics/tests/#{test_id}", nil, nil, false)
54
+ end
55
+
56
+ # Get the most recent results for a synthetics test: GET /v1/synthetics/tests/<SYNTHETICS_TEST_PUBLIC_ID>/results
57
+ def get_synthetics_results(test_id)
58
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/synthetics/tests/#{test_id}/results", nil, nil, false)
59
+ end
60
+
61
+ # Get a specific result for a synthetics test:
62
+ # GET /v1/synthetics/tests/<SYNTHETICS_TEST_PUBLIC_ID>/results/<RESULT_ID>
63
+ def get_synthetics_result(test_id, result_id)
64
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/synthetics/tests/#{test_id}/results/#{result_id}", nil, nil, false)
65
+ end
66
+
67
+ # Get devices for browser checks: GET /v1/synthetics/browser/devices
68
+ def get_synthetics_devices
69
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/synthetics/browser/devices", nil, nil, false)
70
+ end
71
+
72
+ # Get available locations: GET /v1/synthetics/locations
73
+ def get_synthetics_locations
74
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/synthetics/locations", nil, nil, false)
75
+ end
76
+
77
+ end
78
+
79
+ end
80
+ end
@@ -1,3 +1,7 @@
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
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -1,3 +1,7 @@
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
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -1,3 +1,7 @@
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
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -1 +1,5 @@
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
+
1
5
  require 'dogapi/v2/dashboard_list'
@@ -1,3 +1,7 @@
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
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -1,3 +1,7 @@
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
+
1
5
  module Dogapi
2
- VERSION = '1.37.0'
6
+ VERSION = '1.41.0'
3
7
  end
@@ -1,3 +1,7 @@
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
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::Client do
@@ -0,0 +1,55 @@
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
+ CONFIG = {
9
+ account_id: '123456789101',
10
+ role_name: 'DatadogApiTestRole'
11
+ }.freeze
12
+
13
+ UPDATE_CONFIG = {
14
+ account_id: '123456789102',
15
+ filter_tags: ['datadog:true'],
16
+ host_tags: ['api:test'],
17
+ role_name: 'DatadogApiTestRole'
18
+ }.freeze
19
+
20
+ describe '#aws_integration_create' do
21
+ it_behaves_like 'an api method',
22
+ :aws_integration_create, [CONFIG],
23
+ :post, '/integration/aws', CONFIG
24
+ end
25
+
26
+ describe '#aws_integration_list' do
27
+ it_behaves_like 'an api method',
28
+ :aws_integration_list, nil,
29
+ :get, '/integration/aws'
30
+ end
31
+
32
+ describe '#aws_integration_list_namespaces' do
33
+ it_behaves_like 'an api method',
34
+ :aws_integration_list_namespaces, nil,
35
+ :get, '/integration/aws/available_namespace_rules'
36
+ end
37
+
38
+ describe '#aws_integration_generate_external_id' do
39
+ it_behaves_like 'an api method',
40
+ :aws_integration_generate_external_id, [CONFIG],
41
+ :put, '/integration/aws/generate_new_external_id', CONFIG
42
+ end
43
+
44
+ describe '#aws_integration_update' do
45
+ it_behaves_like 'an api method with params and body',
46
+ :aws_integration_update, [CONFIG, UPDATE_CONFIG],
47
+ :put, '/integration/aws', CONFIG, UPDATE_CONFIG
48
+ end
49
+
50
+ describe '#aws_integration_delete' do
51
+ it_behaves_like 'an api method',
52
+ :aws_integration_delete, [CONFIG],
53
+ :delete, '/integration/aws', CONFIG
54
+ end
55
+ end
@@ -0,0 +1,59 @@
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
+ CONFIG = {
9
+ account_id: '123456789101',
10
+ lambda_arn: 'arn:aws:lambda:us-east-1:123456789101:function:LogsCollectionAPITest'
11
+ }.freeze
12
+
13
+ SERVICES_CONFIG = {
14
+ account_id: '601427279990',
15
+ services: %w([s3] [elb] [elbv2] [cloudfront] [redshift] [lambda])
16
+ }.freeze
17
+
18
+ describe '#aws_logs_add_lambda' do
19
+ it_behaves_like 'an api method',
20
+ :aws_logs_add_lambda, [CONFIG],
21
+ :post, '/integration/aws/logs', CONFIG
22
+ end
23
+
24
+ describe '#aws_logs_save_services' do
25
+ it_behaves_like 'an api method',
26
+ :aws_logs_save_services, [SERVICES_CONFIG],
27
+ :post, '/integration/aws/logs/services', SERVICES_CONFIG
28
+ end
29
+
30
+ describe '#aws_logs_check_services' do
31
+ it_behaves_like 'an api method',
32
+ :aws_logs_check_services, [SERVICES_CONFIG],
33
+ :post, '/integration/aws/logs/services_async', SERVICES_CONFIG
34
+ end
35
+
36
+ describe '#aws_logs_check_lambda' do
37
+ it_behaves_like 'an api method',
38
+ :aws_logs_check_lambda, [CONFIG],
39
+ :post, '/integration/aws/logs/check_async', CONFIG
40
+ end
41
+
42
+ describe '#aws_logs_list_services' do
43
+ it_behaves_like 'an api method',
44
+ :aws_logs_list_services, nil,
45
+ :get, '/integration/aws/logs/services'
46
+ end
47
+
48
+ describe '#aws_logs_integrations_list' do
49
+ it_behaves_like 'an api method',
50
+ :aws_logs_integrations_list, nil,
51
+ :get, '/integration/aws/logs'
52
+ end
53
+
54
+ describe '#aws_logs_integration_delete' do
55
+ it_behaves_like 'an api method',
56
+ :aws_logs_integration_delete, [CONFIG],
57
+ :delete, '/integration/aws/logs', CONFIG
58
+ end
59
+ end