dogapi 1.37.1 → 1.42.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.azure-pipelines/all.yml +16 -7
- 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 +51 -71
- data/CHANGELOG.md +37 -0
- data/CONTRIBUTING.md +111 -0
- data/DEVELOPMENT.md +11 -0
- data/Gemfile +2 -0
- data/Gemfile_1.9 +13 -0
- 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 +90 -35
- data/lib/dogapi/event.rb +4 -0
- data/lib/dogapi/facade.rb +212 -10
- data/lib/dogapi/metric.rb +4 -0
- data/lib/dogapi/v1.rb +10 -0
- data/lib/dogapi/v1/alert.rb +4 -0
- data/lib/dogapi/v1/aws_integration.rb +117 -0
- data/lib/dogapi/v1/aws_logs.rb +107 -0
- data/lib/dogapi/v1/azure_integration.rb +85 -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 +76 -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 +20 -7
- 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 +55 -0
- data/spec/integration/aws_logs_spec.rb +59 -0
- data/spec/integration/azure_integration_spec.rb +63 -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 +57 -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 +30 -1
- 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 +21 -0
- data/spec/unit/capistrano_spec.rb +4 -0
- data/spec/unit/common_spec.rb +64 -7
- data/spec/unit/facade_spec.rb +4 -0
- metadata +37 -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'
|
@@ -73,6 +77,23 @@ module SpecDog
|
|
73
77
|
end
|
74
78
|
end
|
75
79
|
|
80
|
+
shared_examples 'an api method with params and body' do |command, args, request, endpoint, params, body|
|
81
|
+
it 'queries the api with params and body' do
|
82
|
+
url = api_url + endpoint
|
83
|
+
stub_request(request, /#{url}/).to_return(body: '{}').then.to_raise(StandardError)
|
84
|
+
expect(dog.send(command, *args)).to eq ['200', {}]
|
85
|
+
params.each { |k, v| params[k] = v.join(',') if v.is_a? Array }
|
86
|
+
params = params
|
87
|
+
|
88
|
+
body = MultiJson.dump(body) if body
|
89
|
+
|
90
|
+
expect(WebMock).to have_requested(request, url).with(
|
91
|
+
query: params,
|
92
|
+
body: body
|
93
|
+
)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
76
97
|
shared_examples 'an api method with optional params' do |command, args, request, endpoint, opt_params|
|
77
98
|
include_examples 'an api method', command, args, request, endpoint
|
78
99
|
it 'queries the api with optional params' 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 '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
|
|
@@ -65,11 +106,12 @@ describe 'Common' do
|
|
65
106
|
'/api/v1/screen']
|
66
107
|
|
67
108
|
urls.each do |url|
|
68
|
-
|
69
|
-
|
70
|
-
expect(params
|
71
|
-
|
72
|
-
expect(
|
109
|
+
expect(service.should_set_api_and_app_keys_in_params?(url)).to be true
|
110
|
+
params = service.prepare_params(nil, url, true)
|
111
|
+
expect(params).to eq("?api_key=#{service.api_key}&application_key=#{service.application_key}")
|
112
|
+
req = service.prepare_request(Net::HTTP::Get, url, params, nil, false, true)
|
113
|
+
expect(req.key?('DD-API-KEY')).to be false
|
114
|
+
expect(req.key?('DD-APPLICATION-KEY')).to be false
|
73
115
|
end
|
74
116
|
end
|
75
117
|
|
@@ -82,10 +124,25 @@ describe 'Common' do
|
|
82
124
|
'/api/v2/users']
|
83
125
|
|
84
126
|
urls.each do |url|
|
85
|
-
|
86
|
-
|
127
|
+
expect(service.should_set_api_and_app_keys_in_params?(url)).to be false
|
128
|
+
params = service.prepare_params(nil, url, true)
|
129
|
+
expect(params).to eq('?')
|
130
|
+
req = service.prepare_request(Net::HTTP::Get, url, params, nil, false, true)
|
131
|
+
expect(req.key?('DD-API-KEY')).to be true
|
132
|
+
expect(req['DD-API-KEY']).to eq service.api_key
|
133
|
+
expect(req.key?('DD-APPLICATION-KEY')).to be true
|
134
|
+
expect(req['DD-APPLICATION-KEY']).to eq service.application_key
|
87
135
|
end
|
88
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
|
89
146
|
end
|
90
147
|
end
|
91
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.42.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-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -75,16 +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
|
94
|
+
- Gemfile_1.9
|
85
95
|
- LICENSE
|
96
|
+
- LICENSE-3rdparty.csv
|
86
97
|
- README.rdoc
|
98
|
+
- RELEASING.md
|
87
99
|
- Rakefile
|
100
|
+
- SUPPORT.md
|
88
101
|
- dogapi.gemspec
|
89
102
|
- examples/Capfile
|
90
103
|
- examples/custom_event.rb
|
@@ -100,12 +113,16 @@ files:
|
|
100
113
|
- lib/dogapi/metric.rb
|
101
114
|
- lib/dogapi/v1.rb
|
102
115
|
- lib/dogapi/v1/alert.rb
|
116
|
+
- lib/dogapi/v1/aws_integration.rb
|
117
|
+
- lib/dogapi/v1/aws_logs.rb
|
118
|
+
- lib/dogapi/v1/azure_integration.rb
|
103
119
|
- lib/dogapi/v1/comment.rb
|
104
120
|
- lib/dogapi/v1/dash.rb
|
105
121
|
- lib/dogapi/v1/dashboard.rb
|
106
122
|
- lib/dogapi/v1/dashboard_list.rb
|
107
123
|
- lib/dogapi/v1/embed.rb
|
108
124
|
- lib/dogapi/v1/event.rb
|
125
|
+
- lib/dogapi/v1/gcp_integration.rb
|
109
126
|
- lib/dogapi/v1/hosts.rb
|
110
127
|
- lib/dogapi/v1/integration.rb
|
111
128
|
- lib/dogapi/v1/metadata.rb
|
@@ -114,7 +131,9 @@ files:
|
|
114
131
|
- lib/dogapi/v1/screenboard.rb
|
115
132
|
- lib/dogapi/v1/search.rb
|
116
133
|
- lib/dogapi/v1/service_check.rb
|
134
|
+
- lib/dogapi/v1/service_level_objective.rb
|
117
135
|
- lib/dogapi/v1/snapshot.rb
|
136
|
+
- lib/dogapi/v1/synthetics.rb
|
118
137
|
- lib/dogapi/v1/tag.rb
|
119
138
|
- lib/dogapi/v1/usage.rb
|
120
139
|
- lib/dogapi/v1/user.rb
|
@@ -122,6 +141,9 @@ files:
|
|
122
141
|
- lib/dogapi/v2/dashboard_list.rb
|
123
142
|
- lib/dogapi/version.rb
|
124
143
|
- spec/integration/alert_spec.rb
|
144
|
+
- spec/integration/aws_integration_spec.rb
|
145
|
+
- spec/integration/aws_logs_spec.rb
|
146
|
+
- spec/integration/azure_integration_spec.rb
|
125
147
|
- spec/integration/comment_spec.rb
|
126
148
|
- spec/integration/common_spec.rb
|
127
149
|
- spec/integration/dash_spec.rb
|
@@ -129,6 +151,7 @@ files:
|
|
129
151
|
- spec/integration/dashboard_spec.rb
|
130
152
|
- spec/integration/embed_spec.rb
|
131
153
|
- spec/integration/event_spec.rb
|
154
|
+
- spec/integration/gcp_integration_spec.rb
|
132
155
|
- spec/integration/integration_spec.rb
|
133
156
|
- spec/integration/metadata_spec.rb
|
134
157
|
- spec/integration/metric_spec.rb
|
@@ -136,7 +159,9 @@ files:
|
|
136
159
|
- spec/integration/screenboard_spec.rb
|
137
160
|
- spec/integration/search_spec.rb
|
138
161
|
- spec/integration/service_check_spec.rb
|
162
|
+
- spec/integration/service_level_objective_spec.rb
|
139
163
|
- spec/integration/snapshot_spec.rb
|
164
|
+
- spec/integration/synthetics_spec.rb
|
140
165
|
- spec/integration/tag_spec.rb
|
141
166
|
- spec/integration/usage_spec.rb
|
142
167
|
- spec/integration/user_spec.rb
|
@@ -152,7 +177,7 @@ metadata:
|
|
152
177
|
changelog_uri: https://github.com/DataDog/dogapi-rb/blob/master/CHANGELOG.md
|
153
178
|
documentation_uri: https://docs.datadoghq.com/api/
|
154
179
|
source_code_uri: https://github.com/DataDog/dogapi-rb
|
155
|
-
post_install_message:
|
180
|
+
post_install_message:
|
156
181
|
rdoc_options:
|
157
182
|
- "--title"
|
158
183
|
- DogAPI -- Datadog Client
|
@@ -173,13 +198,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
198
|
- !ruby/object:Gem::Version
|
174
199
|
version: '0'
|
175
200
|
requirements: []
|
176
|
-
|
177
|
-
|
178
|
-
signing_key:
|
201
|
+
rubygems_version: 3.1.2
|
202
|
+
signing_key:
|
179
203
|
specification_version: 4
|
180
204
|
summary: Ruby bindings for Datadog's API
|
181
205
|
test_files:
|
182
206
|
- spec/integration/alert_spec.rb
|
207
|
+
- spec/integration/aws_integration_spec.rb
|
208
|
+
- spec/integration/aws_logs_spec.rb
|
209
|
+
- spec/integration/azure_integration_spec.rb
|
183
210
|
- spec/integration/comment_spec.rb
|
184
211
|
- spec/integration/common_spec.rb
|
185
212
|
- spec/integration/dash_spec.rb
|
@@ -187,6 +214,7 @@ test_files:
|
|
187
214
|
- spec/integration/dashboard_spec.rb
|
188
215
|
- spec/integration/embed_spec.rb
|
189
216
|
- spec/integration/event_spec.rb
|
217
|
+
- spec/integration/gcp_integration_spec.rb
|
190
218
|
- spec/integration/integration_spec.rb
|
191
219
|
- spec/integration/metadata_spec.rb
|
192
220
|
- spec/integration/metric_spec.rb
|
@@ -194,7 +222,9 @@ test_files:
|
|
194
222
|
- spec/integration/screenboard_spec.rb
|
195
223
|
- spec/integration/search_spec.rb
|
196
224
|
- spec/integration/service_check_spec.rb
|
225
|
+
- spec/integration/service_level_objective_spec.rb
|
197
226
|
- spec/integration/snapshot_spec.rb
|
227
|
+
- spec/integration/synthetics_spec.rb
|
198
228
|
- spec/integration/tag_spec.rb
|
199
229
|
- spec/integration/usage_spec.rb
|
200
230
|
- spec/integration/user_spec.rb
|