dogapi 1.38.0 → 1.43.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.
- checksums.yaml +4 -4
- data/.azure-pipelines/all.yml +43 -12
- data/.github/CODEOWNERS +10 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +36 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +77 -0
- data/.github/labeler.yml +5 -0
- data/.github/workflows/labeler.yml +11 -0
- data/.github/workflows/stale.yml +39 -0
- data/.rubocop_todo.yml +30 -32
- data/CHANGELOG.md +28 -0
- data/CONTRIBUTING.md +111 -0
- data/DEVELOPMENT.md +11 -0
- data/Gemfile +1 -1
- data/Gemfile_1.9 +0 -1
- data/LICENSE +21 -20
- data/LICENSE-3rdparty.csv +6 -0
- data/README.rdoc +14 -0
- data/RELEASING.md +46 -0
- data/SUPPORT.md +9 -0
- data/dogapi.gemspec +2 -0
- data/examples/custom_metric.rb +1 -1
- data/lib/capistrano/README.md +4 -1
- data/lib/capistrano/datadog.rb +8 -4
- data/lib/capistrano/datadog/v2.rb +9 -1
- data/lib/capistrano/datadog/v3.rb +10 -1
- data/lib/dogapi.rb +4 -0
- data/lib/dogapi/common.rb +70 -12
- data/lib/dogapi/event.rb +4 -0
- data/lib/dogapi/facade.rb +99 -8
- data/lib/dogapi/metric.rb +4 -0
- data/lib/dogapi/v1.rb +6 -0
- data/lib/dogapi/v1/alert.rb +4 -0
- data/lib/dogapi/v1/aws_integration.rb +4 -0
- data/lib/dogapi/v1/aws_logs.rb +4 -0
- data/lib/dogapi/v1/azure_integration.rb +4 -0
- data/lib/dogapi/v1/comment.rb +4 -0
- data/lib/dogapi/v1/dash.rb +10 -4
- data/lib/dogapi/v1/dashboard.rb +16 -0
- data/lib/dogapi/v1/dashboard_list.rb +4 -0
- data/lib/dogapi/v1/embed.rb +4 -0
- data/lib/dogapi/v1/event.rb +4 -0
- data/lib/dogapi/v1/gcp_integration.rb +4 -0
- data/lib/dogapi/v1/hosts.rb +4 -0
- data/lib/dogapi/v1/integration.rb +4 -0
- data/lib/dogapi/v1/metadata.rb +4 -0
- data/lib/dogapi/v1/metric.rb +4 -0
- data/lib/dogapi/v1/monitor.rb +6 -2
- data/lib/dogapi/v1/screenboard.rb +4 -0
- data/lib/dogapi/v1/search.rb +4 -0
- data/lib/dogapi/v1/service_check.rb +4 -0
- data/lib/dogapi/v1/service_level_objective.rb +113 -0
- data/lib/dogapi/v1/snapshot.rb +4 -0
- data/lib/dogapi/v1/synthetics.rb +80 -0
- data/lib/dogapi/v1/tag.rb +4 -0
- data/lib/dogapi/v1/usage.rb +4 -0
- data/lib/dogapi/v1/user.rb +4 -0
- data/lib/dogapi/v2.rb +4 -0
- data/lib/dogapi/v2/dashboard_list.rb +4 -0
- data/lib/dogapi/version.rb +5 -1
- data/spec/integration/alert_spec.rb +4 -0
- data/spec/integration/aws_integration_spec.rb +4 -0
- data/spec/integration/aws_logs_spec.rb +4 -0
- data/spec/integration/azure_integration_spec.rb +4 -0
- data/spec/integration/comment_spec.rb +5 -0
- data/spec/integration/common_spec.rb +4 -0
- data/spec/integration/dash_spec.rb +7 -1
- data/spec/integration/dashboard_list_spec.rb +4 -0
- data/spec/integration/dashboard_spec.rb +15 -1
- data/spec/integration/embed_spec.rb +4 -0
- data/spec/integration/event_spec.rb +5 -0
- data/spec/integration/gcp_integration_spec.rb +4 -0
- data/spec/integration/integration_spec.rb +4 -0
- data/spec/integration/metadata_spec.rb +4 -0
- data/spec/integration/metric_spec.rb +4 -0
- data/spec/integration/monitor_spec.rb +15 -0
- data/spec/integration/screenboard_spec.rb +4 -0
- data/spec/integration/search_spec.rb +4 -0
- data/spec/integration/service_check_spec.rb +4 -0
- data/spec/integration/service_level_objective_spec.rb +73 -0
- data/spec/integration/snapshot_spec.rb +4 -0
- data/spec/integration/synthetics_spec.rb +131 -0
- data/spec/integration/tag_spec.rb +4 -0
- data/spec/integration/usage_spec.rb +4 -0
- data/spec/integration/user_spec.rb +4 -0
- data/spec/spec_helper.rb +17 -1
- data/spec/unit/capistrano_spec.rb +4 -0
- data/spec/unit/common_spec.rb +50 -0
- data/spec/unit/facade_spec.rb +4 -0
- metadata +24 -7
@@ -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
|
@@ -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
|
@@ -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,73 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe Dogapi::Client do
|
4
|
+
SLO_ID = '42424242424242424242424242424242'.freeze
|
5
|
+
SLO_TYPE = 'metric'.freeze
|
6
|
+
SLO_NAME = 'test slo'.freeze
|
7
|
+
SLO_DESCRIPTION = 'test slo description'.freeze
|
8
|
+
SLO_QUERY_NUMERATOR = 'sum:test.metric.metric{type:good}.as_count()'.freeze
|
9
|
+
SLO_QUERY_DENOMINATOR = 'sum:test.metric.metric{*}.as_count()'.freeze
|
10
|
+
SLO_TAGS = ['type:test'].freeze
|
11
|
+
SLO_THRESHOLDS = [{ timeframe: '7d', target: 90 }, { timeframe: '30d', target: 95 }].freeze
|
12
|
+
|
13
|
+
describe '#create_service_level_objective' do
|
14
|
+
it_behaves_like 'an api method',
|
15
|
+
:create_service_level_objective, [SLO_TYPE, SLO_NAME, SLO_THRESHOLDS, {
|
16
|
+
description: SLO_DESCRIPTION,
|
17
|
+
tags: SLO_TAGS,
|
18
|
+
numerator: SLO_QUERY_NUMERATOR,
|
19
|
+
denominator: SLO_QUERY_DENOMINATOR
|
20
|
+
}],
|
21
|
+
:post, '/slo', 'type' => SLO_TYPE, 'name' => SLO_NAME, 'thresholds' => SLO_THRESHOLDS,
|
22
|
+
'query' => { numerator: SLO_QUERY_NUMERATOR, denominator: SLO_QUERY_DENOMINATOR },
|
23
|
+
'tags' => SLO_TAGS, 'description' => SLO_DESCRIPTION
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#update_service_level_objective' do
|
27
|
+
it_behaves_like 'an api method',
|
28
|
+
:update_service_level_objective, [SLO_ID, SLO_TYPE, { name: SLO_NAME }],
|
29
|
+
:put, "/slo/#{SLO_ID}", 'type' => SLO_TYPE, 'name' => SLO_NAME
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#get_service_level_objective' do
|
33
|
+
it_behaves_like 'an api method',
|
34
|
+
:get_service_level_objective, [SLO_ID],
|
35
|
+
:get, "/slo/#{SLO_ID}"
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#get_service_level_objective_history' do
|
39
|
+
it_behaves_like 'an api method with params',
|
40
|
+
:get_service_level_objective_history, [SLO_ID],
|
41
|
+
:get, "/slo/#{SLO_ID}/history", 'from_ts' => 0, 'to_ts' => 1_000_000
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '#can_delete_service_level_objective' do
|
45
|
+
it_behaves_like 'an api method with params',
|
46
|
+
:can_delete_service_level_objective, [],
|
47
|
+
:get, '/slo/can_delete', 'ids' => [SLO_ID]
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '#search_service_level_objective' do
|
51
|
+
it_behaves_like 'an api method with optional params',
|
52
|
+
:search_service_level_objective, [[SLO_ID]],
|
53
|
+
:get, '/slo/', 'ids' => SLO_ID
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#delete_service_level_objective' do
|
57
|
+
it_behaves_like 'an api method',
|
58
|
+
:delete_service_level_objective, [SLO_ID],
|
59
|
+
:delete, "/slo/#{SLO_ID}"
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#delete_many_service_level_objective' do
|
63
|
+
it_behaves_like 'an api method',
|
64
|
+
:delete_many_service_level_objective, [[SLO_ID]],
|
65
|
+
:delete, '/slo/', 'ids' => [SLO_ID]
|
66
|
+
end
|
67
|
+
|
68
|
+
describe '#delete_timeframes_service_level_objective' do
|
69
|
+
it_behaves_like 'an api method',
|
70
|
+
:delete_timeframes_service_level_objective, [{ SLO_ID => ['7d'] }],
|
71
|
+
:post, '/slo/bulk_delete', SLO_ID => ['7d']
|
72
|
+
end
|
73
|
+
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,131 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe Dogapi::Client do
|
4
|
+
SYNTHETICS_TEST_PUBLIC_ID = '84r-szk-xpt'
|
5
|
+
SYNTHETICS_TESTS_PUBLIC_IDS = ['84r-szk-xpt', 'sti-s2m-ciz']
|
6
|
+
NEW_STATUS = 'paused'
|
7
|
+
SYNTHETICS_RESULT_ID = 123_456
|
8
|
+
|
9
|
+
SYNTHETICS_TEST_TYPE = 'api'.freeze
|
10
|
+
SYNTHETICS_TEST_CONFIG = {
|
11
|
+
'assertions' => [
|
12
|
+
{
|
13
|
+
'operator' => 'is',
|
14
|
+
'type' => 'statusCode',
|
15
|
+
'target' => 403
|
16
|
+
},
|
17
|
+
{
|
18
|
+
'operator' => 'is',
|
19
|
+
'property' => 'content-type',
|
20
|
+
'type' => 'header',
|
21
|
+
'target' => 'text/html'
|
22
|
+
},
|
23
|
+
{
|
24
|
+
'operator' => 'lessThan',
|
25
|
+
'type' => 'responseTime',
|
26
|
+
'target' => 2000
|
27
|
+
}
|
28
|
+
],
|
29
|
+
'request' => {
|
30
|
+
'method' => 'GET',
|
31
|
+
'url' => 'https://datadoghq.com',
|
32
|
+
'timeout' => 30,
|
33
|
+
'headers' => {
|
34
|
+
'header1' => 'value1',
|
35
|
+
'header2' => 'value2'
|
36
|
+
},
|
37
|
+
'body' => 'body to send with the request'
|
38
|
+
}
|
39
|
+
}.freeze
|
40
|
+
|
41
|
+
SYNTHETICS_TEST_OPTIONS = {
|
42
|
+
'locations' => [
|
43
|
+
'aws:us-east-2',
|
44
|
+
'aws:eu-central-1',
|
45
|
+
'aws:ca-central-1'
|
46
|
+
],
|
47
|
+
'options' => {
|
48
|
+
'tick_every' => 60,
|
49
|
+
'min_failure_duration' => 0,
|
50
|
+
'min_location_failed' => 1,
|
51
|
+
'follow_redirects' => true
|
52
|
+
},
|
53
|
+
'message' => 'Test with API',
|
54
|
+
'name' => 'Test with API',
|
55
|
+
'tags' => ['key1:value1', 'key2:value2']
|
56
|
+
}.freeze
|
57
|
+
|
58
|
+
describe '#create_synthetics_test' do
|
59
|
+
it 'queries the api' do
|
60
|
+
url = api_url + '/synthetics/tests'
|
61
|
+
stub_request(:post, /#{url}/).to_return(body: '{}').then.to_raise(StandardError)
|
62
|
+
expect(dog.send(:create_synthetics_test, SYNTHETICS_TEST_TYPE, SYNTHETICS_TEST_CONFIG,
|
63
|
+
SYNTHETICS_TEST_OPTIONS)).to eq ['200', {}]
|
64
|
+
|
65
|
+
expect(WebMock).to have_requested(:post, url)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe '#update_synthetics_test' do
|
70
|
+
it 'queries the api' do
|
71
|
+
url = api_url + "/synthetics/tests/#{SYNTHETICS_TEST_PUBLIC_ID}"
|
72
|
+
stub_request(:put, /#{url}/).to_return(body: '{}').then.to_raise(StandardError)
|
73
|
+
expect(dog.send(:update_synthetics_test, SYNTHETICS_TEST_PUBLIC_ID, SYNTHETICS_TEST_TYPE,
|
74
|
+
SYNTHETICS_TEST_CONFIG, SYNTHETICS_TEST_OPTIONS)).to eq ['200', {}]
|
75
|
+
|
76
|
+
expect(WebMock).to have_requested(:put, url)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe '#delete_synthetics_tests' do
|
81
|
+
it_behaves_like 'an api method',
|
82
|
+
:delete_synthetics_tests, [SYNTHETICS_TESTS_PUBLIC_IDS],
|
83
|
+
:post, '/synthetics/tests/delete', 'public_ids' => SYNTHETICS_TESTS_PUBLIC_IDS
|
84
|
+
end
|
85
|
+
|
86
|
+
describe '#start_pause_synthetics_test' do
|
87
|
+
it_behaves_like 'an api method',
|
88
|
+
:start_pause_synthetics_test, [SYNTHETICS_TEST_PUBLIC_ID, NEW_STATUS],
|
89
|
+
:put, "/synthetics/tests/#{SYNTHETICS_TEST_PUBLIC_ID}/status", 'new_status' => NEW_STATUS
|
90
|
+
end
|
91
|
+
|
92
|
+
describe '#get_all_synthetics_tests' do
|
93
|
+
it_behaves_like 'an api method',
|
94
|
+
:get_all_synthetics_tests, [],
|
95
|
+
:get, '/synthetics/tests'
|
96
|
+
end
|
97
|
+
|
98
|
+
describe '#get_synthetics_test' do
|
99
|
+
it_behaves_like 'an api method',
|
100
|
+
:get_synthetics_test, [SYNTHETICS_TEST_PUBLIC_ID],
|
101
|
+
:get, "/synthetics/tests/#{SYNTHETICS_TEST_PUBLIC_ID}"
|
102
|
+
end
|
103
|
+
|
104
|
+
describe '#get_synthetics_results' do
|
105
|
+
it_behaves_like 'an api method',
|
106
|
+
:get_synthetics_results, [SYNTHETICS_TEST_PUBLIC_ID],
|
107
|
+
:get, "/synthetics/tests/#{SYNTHETICS_TEST_PUBLIC_ID}/results"
|
108
|
+
end
|
109
|
+
|
110
|
+
describe '#get_synthetics_result' do
|
111
|
+
it 'queries the api' do
|
112
|
+
url = api_url + "/synthetics/tests/#{SYNTHETICS_TEST_PUBLIC_ID}/results/#{SYNTHETICS_RESULT_ID}"
|
113
|
+
stub_request(:get, /#{url}/).to_return(body: '{}').then.to_raise(StandardError)
|
114
|
+
expect(dog.send(:get_synthetics_result, SYNTHETICS_TEST_PUBLIC_ID, SYNTHETICS_RESULT_ID)).to eq ['200', {}]
|
115
|
+
|
116
|
+
expect(WebMock).to have_requested(:get, url)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe '#get_synthetics_devices' do
|
121
|
+
it_behaves_like 'an api method',
|
122
|
+
:get_synthetics_devices, [],
|
123
|
+
:get, '/synthetics/browser/devices'
|
124
|
+
end
|
125
|
+
|
126
|
+
describe '#get_synthetics_locations' do
|
127
|
+
it_behaves_like 'an api method',
|
128
|
+
:get_synthetics_locations, [],
|
129
|
+
:get, '/synthetics/locations'
|
130
|
+
end
|
131
|
+
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
|
@@ -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
|
@@ -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
|
data/spec/spec_helper.rb
CHANGED
@@ -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 'rspec'
|
2
6
|
require 'simplecov'
|
3
7
|
require 'webmock/rspec'
|
@@ -6,7 +10,19 @@ SimpleCov.start do
|
|
6
10
|
add_filter 'spec'
|
7
11
|
end
|
8
12
|
|
9
|
-
|
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)
|
10
26
|
|
11
27
|
# include our code and methods
|
12
28
|
require '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 'spec_helper'
|
2
6
|
require 'capistrano/datadog'
|
3
7
|
require 'benchmark'
|
data/spec/unit/common_spec.rb
CHANGED
@@ -1,6 +1,27 @@
|
|
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 'Common' do
|
8
|
+
describe 'validate_tags' do
|
9
|
+
it 'raises if tags is not an array' do
|
10
|
+
tags = 'foo:bar'
|
11
|
+
expect { Dogapi.validate_tags(tags) }.to raise_error(ArgumentError)
|
12
|
+
tags = nil
|
13
|
+
expect { Dogapi.validate_tags(tags) }.to raise_error(ArgumentError)
|
14
|
+
end
|
15
|
+
it 'raises if elements of tags are not strings' do
|
16
|
+
tags = ['toto:tata', { foo: 'bar' }]
|
17
|
+
expect { Dogapi.validate_tags(tags) }.to raise_error(ArgumentError)
|
18
|
+
end
|
19
|
+
it 'passes if tags are correct' do
|
20
|
+
tags = ['foo:bar', 'baz']
|
21
|
+
Dogapi.validate_tags(tags)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
4
25
|
describe Dogapi.find_datadog_host do
|
5
26
|
it 'gives precedence to DATADOG_HOST env var' do
|
6
27
|
allow(ENV).to receive(:[]).with('DATADOG_HOST').and_return('example.com')
|
@@ -40,6 +61,26 @@ describe 'Common' do
|
|
40
61
|
ENV['http_proxy'] = nil
|
41
62
|
end
|
42
63
|
|
64
|
+
it 'uses-the dogapi specific proxy if set' do
|
65
|
+
service = Dogapi::APIService.new('api_key', 'app_key')
|
66
|
+
|
67
|
+
service.connect do |conn|
|
68
|
+
expect(conn.proxy_address).to be(nil)
|
69
|
+
expect(conn.proxy_port).to be(nil)
|
70
|
+
end
|
71
|
+
|
72
|
+
ENV['https_proxy'] = 'https://www.proxy.com:443'
|
73
|
+
ENV['dd_proxy_https'] = 'https://www.otherproxy.com:443'
|
74
|
+
|
75
|
+
service.connect do |conn|
|
76
|
+
expect(conn.proxy_address).to eq 'www.otherproxy.com'
|
77
|
+
expect(conn.proxy_port).to eq 443
|
78
|
+
end
|
79
|
+
|
80
|
+
ENV['https_proxy'] = nil
|
81
|
+
ENV['dd_proxy_https'] = nil
|
82
|
+
end
|
83
|
+
|
43
84
|
it 'respects the endpoint configuration' do
|
44
85
|
service = Dogapi::APIService.new('api_key', 'app_key', true, nil, 'https://app.example.com')
|
45
86
|
|
@@ -93,6 +134,15 @@ describe 'Common' do
|
|
93
134
|
expect(req['DD-APPLICATION-KEY']).to eq service.application_key
|
94
135
|
end
|
95
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
|
96
146
|
end
|
97
147
|
end
|
98
148
|
|
data/spec/unit/facade_spec.rb
CHANGED
@@ -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 'spec_helper'
|
2
6
|
|
3
7
|
describe Dogapi::Client do
|
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.
|
4
|
+
version: 1.43.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:
|
11
|
+
date: 2020-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -75,17 +75,29 @@ extra_rdoc_files:
|
|
75
75
|
- README.rdoc
|
76
76
|
files:
|
77
77
|
- ".azure-pipelines/all.yml"
|
78
|
+
- ".github/CODEOWNERS"
|
79
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
80
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
81
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
82
|
+
- ".github/labeler.yml"
|
83
|
+
- ".github/workflows/labeler.yml"
|
84
|
+
- ".github/workflows/stale.yml"
|
78
85
|
- ".gitignore"
|
79
86
|
- ".rspec"
|
80
87
|
- ".rubocop.yml"
|
81
88
|
- ".rubocop_todo.yml"
|
82
89
|
- ".tailor"
|
83
90
|
- CHANGELOG.md
|
91
|
+
- CONTRIBUTING.md
|
92
|
+
- DEVELOPMENT.md
|
84
93
|
- Gemfile
|
85
94
|
- Gemfile_1.9
|
86
95
|
- LICENSE
|
96
|
+
- LICENSE-3rdparty.csv
|
87
97
|
- README.rdoc
|
98
|
+
- RELEASING.md
|
88
99
|
- Rakefile
|
100
|
+
- SUPPORT.md
|
89
101
|
- dogapi.gemspec
|
90
102
|
- examples/Capfile
|
91
103
|
- examples/custom_event.rb
|
@@ -119,7 +131,9 @@ files:
|
|
119
131
|
- lib/dogapi/v1/screenboard.rb
|
120
132
|
- lib/dogapi/v1/search.rb
|
121
133
|
- lib/dogapi/v1/service_check.rb
|
134
|
+
- lib/dogapi/v1/service_level_objective.rb
|
122
135
|
- lib/dogapi/v1/snapshot.rb
|
136
|
+
- lib/dogapi/v1/synthetics.rb
|
123
137
|
- lib/dogapi/v1/tag.rb
|
124
138
|
- lib/dogapi/v1/usage.rb
|
125
139
|
- lib/dogapi/v1/user.rb
|
@@ -145,7 +159,9 @@ files:
|
|
145
159
|
- spec/integration/screenboard_spec.rb
|
146
160
|
- spec/integration/search_spec.rb
|
147
161
|
- spec/integration/service_check_spec.rb
|
162
|
+
- spec/integration/service_level_objective_spec.rb
|
148
163
|
- spec/integration/snapshot_spec.rb
|
164
|
+
- spec/integration/synthetics_spec.rb
|
149
165
|
- spec/integration/tag_spec.rb
|
150
166
|
- spec/integration/usage_spec.rb
|
151
167
|
- spec/integration/user_spec.rb
|
@@ -161,7 +177,7 @@ metadata:
|
|
161
177
|
changelog_uri: https://github.com/DataDog/dogapi-rb/blob/master/CHANGELOG.md
|
162
178
|
documentation_uri: https://docs.datadoghq.com/api/
|
163
179
|
source_code_uri: https://github.com/DataDog/dogapi-rb
|
164
|
-
post_install_message:
|
180
|
+
post_install_message:
|
165
181
|
rdoc_options:
|
166
182
|
- "--title"
|
167
183
|
- DogAPI -- Datadog Client
|
@@ -182,9 +198,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
198
|
- !ruby/object:Gem::Version
|
183
199
|
version: '0'
|
184
200
|
requirements: []
|
185
|
-
|
186
|
-
|
187
|
-
signing_key:
|
201
|
+
rubygems_version: 3.0.6
|
202
|
+
signing_key:
|
188
203
|
specification_version: 4
|
189
204
|
summary: Ruby bindings for Datadog's API
|
190
205
|
test_files:
|
@@ -207,7 +222,9 @@ test_files:
|
|
207
222
|
- spec/integration/screenboard_spec.rb
|
208
223
|
- spec/integration/search_spec.rb
|
209
224
|
- spec/integration/service_check_spec.rb
|
225
|
+
- spec/integration/service_level_objective_spec.rb
|
210
226
|
- spec/integration/snapshot_spec.rb
|
227
|
+
- spec/integration/synthetics_spec.rb
|
211
228
|
- spec/integration/tag_spec.rb
|
212
229
|
- spec/integration/usage_spec.rb
|
213
230
|
- spec/integration/user_spec.rb
|