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 'dogapi'
|
2
6
|
|
3
7
|
module Dogapi
|
data/lib/dogapi/version.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
|
module Dogapi
|
2
|
-
VERSION = '1.
|
6
|
+
VERSION = '1.42.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
|
@@ -0,0 +1,63 @@
|
|
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
|
+
tenant_name: 'testc44-1234-5678-9101-cc00736ftest',
|
10
|
+
client_id: 'testc7f6-1234-5678-9101-3fcbf464test'
|
11
|
+
}.freeze
|
12
|
+
|
13
|
+
CREATE_CONFIG = {
|
14
|
+
tenant_name: 'testc44-1234-5678-9101-cc00736ftest',
|
15
|
+
host_filters: 'api:test',
|
16
|
+
client_id: 'testc7f6-1234-5678-9101-3fcbf464test',
|
17
|
+
client_secret: 'testingx./Sw*g/Y33t..R1cH+hScMDt'
|
18
|
+
}.freeze
|
19
|
+
|
20
|
+
UPDATE_HF_CONFIG = {
|
21
|
+
tenant_name: 'testc44-1234-5678-9101-cc00736ftest',
|
22
|
+
host_filters: 'api:test1,api:test2',
|
23
|
+
client_id: 'testc7f6-1234-5678-9101-3fcbf464test'
|
24
|
+
}.freeze
|
25
|
+
|
26
|
+
UPDATE_CONFIG = {
|
27
|
+
tenant_name: 'testc44-1234-5678-9101-cc00736ftest',
|
28
|
+
new_tenant_name: '1234abcd-1234-5678-9101-abcd1234abcd',
|
29
|
+
host_filters: 'api:test3',
|
30
|
+
client_id: 'testc7f6-1234-5678-9101-3fcbf464test',
|
31
|
+
new_client_id: 'abcd1234-5678-1234-5678-1234abcd5678'
|
32
|
+
}.freeze
|
33
|
+
|
34
|
+
describe '#azure_integration_list' do
|
35
|
+
it_behaves_like 'an api method',
|
36
|
+
:azure_integration_list, nil,
|
37
|
+
:get, '/integration/azure'
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#azure_integration_create' do
|
41
|
+
it_behaves_like 'an api method',
|
42
|
+
:azure_integration_create, [CREATE_CONFIG],
|
43
|
+
:post, '/integration/azure', CREATE_CONFIG
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#azure_integration_update_host_filters' do
|
47
|
+
it_behaves_like 'an api method',
|
48
|
+
:azure_integration_update_host_filters, [UPDATE_HF_CONFIG],
|
49
|
+
:post, '/integration/azure/host_filters', UPDATE_HF_CONFIG
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#azure_integration_update' do
|
53
|
+
it_behaves_like 'an api method',
|
54
|
+
:azure_integration_update, [UPDATE_CONFIG],
|
55
|
+
:put, '/integration/azure', UPDATE_CONFIG
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#azure_integration_delete' do
|
59
|
+
it_behaves_like 'an api method',
|
60
|
+
:azure_integration_delete, [CONFIG],
|
61
|
+
:delete, '/integration/azure', CONFIG
|
62
|
+
end
|
63
|
+
end
|
@@ -1,4 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
|
3
|
+
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
|
4
|
+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
|
5
|
+
# Copyright 2011-Present Datadog, Inc.
|
6
|
+
|
2
7
|
require_relative '../spec_helper'
|
3
8
|
|
4
9
|
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::APIService 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
|
@@ -19,12 +23,14 @@ describe Dogapi::Client do
|
|
19
23
|
'prefix' => 'host',
|
20
24
|
'default' => 'host:my-host'
|
21
25
|
}].freeze
|
26
|
+
READ_ONLY = false
|
22
27
|
|
23
28
|
DASH_BODY = {
|
24
29
|
title: TITLE,
|
25
30
|
description: DESCRIPTION,
|
26
31
|
graphs: GRAPHS,
|
27
|
-
template_variables: TEMPLATE_VARIABLES
|
32
|
+
template_variables: TEMPLATE_VARIABLES,
|
33
|
+
read_only: READ_ONLY
|
28
34
|
}.freeze
|
29
35
|
DASH_ARGS = DASH_BODY.values
|
30
36
|
|
@@ -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
|
@@ -22,6 +26,15 @@ describe Dogapi::Client do
|
|
22
26
|
'prefix' => 'host',
|
23
27
|
'default' => 'my-host'
|
24
28
|
}].freeze
|
29
|
+
TEMPLATE_VARIABLE_PRESETS = [{
|
30
|
+
'name' => 'preset1',
|
31
|
+
'template_variables' => [
|
32
|
+
{
|
33
|
+
'name' => 'host1',
|
34
|
+
'value' => 'my-host'
|
35
|
+
}
|
36
|
+
]
|
37
|
+
}].freeze
|
25
38
|
|
26
39
|
REQUIRED_ARGS = {
|
27
40
|
title: TITLE,
|
@@ -33,7 +46,8 @@ describe Dogapi::Client do
|
|
33
46
|
description: DESCRIPTION,
|
34
47
|
is_read_only: IS_READ_ONLY,
|
35
48
|
notify_list: NOTIFY_LIST,
|
36
|
-
template_variables: TEMPLATE_VARIABLES
|
49
|
+
template_variables: TEMPLATE_VARIABLES,
|
50
|
+
template_variable_presets: TEMPLATE_VARIABLE_PRESETS
|
37
51
|
}
|
38
52
|
DASHBOARD_ARGS = REQUIRED_ARGS.values + [OPTIONS]
|
39
53
|
DASHBOARD_PAYLOAD = REQUIRED_ARGS.merge(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_relative '../spec_helper'
|
2
6
|
|
3
7
|
describe Dogapi::Client do
|
@@ -1,4 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
|
3
|
+
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
|
4
|
+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
|
5
|
+
# Copyright 2011-Present Datadog, Inc.
|
6
|
+
|
2
7
|
require_relative '../spec_helper'
|
3
8
|
|
4
9
|
describe Dogapi::Client do
|
@@ -0,0 +1,57 @@
|
|
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
|
+
project_id: 'datadog-apitest',
|
10
|
+
client_email: 'email@example.com'
|
11
|
+
}.freeze
|
12
|
+
|
13
|
+
CREATE_CONFIG = {
|
14
|
+
type: 'service_account',
|
15
|
+
project_id: 'datadog-apitest',
|
16
|
+
private_key_id: '123456789abcdefghi123456789abcdefghijklm',
|
17
|
+
private_key: 'fake_key',
|
18
|
+
client_email: 'email@example.com',
|
19
|
+
client_id: '123456712345671234567',
|
20
|
+
auth_uri: 'fake_uri',
|
21
|
+
token_uri: 'fake_uri',
|
22
|
+
auth_provider_x509_cert_url: 'fake_url',
|
23
|
+
client_x509_cert_url: 'fake_url',
|
24
|
+
host_filters: 'api:test'
|
25
|
+
}.freeze
|
26
|
+
|
27
|
+
UPDATE_CONFIG = {
|
28
|
+
project_id: 'datadog-apitest',
|
29
|
+
client_email: 'email@example.com',
|
30
|
+
host_filters: 'api:test1,api:test2',
|
31
|
+
automute: false
|
32
|
+
}.freeze
|
33
|
+
|
34
|
+
describe '#gcp_integration_list' do
|
35
|
+
it_behaves_like 'an api method',
|
36
|
+
:gcp_integration_list, nil,
|
37
|
+
:get, '/integration/gcp'
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#gcp_integration_create' do
|
41
|
+
it_behaves_like 'an api method',
|
42
|
+
:gcp_integration_create, [CREATE_CONFIG],
|
43
|
+
:post, '/integration/gcp', CREATE_CONFIG
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#gcp_integration_update' do
|
47
|
+
it_behaves_like 'an api method',
|
48
|
+
:gcp_integration_update, [UPDATE_CONFIG],
|
49
|
+
:put, '/integration/gcp', UPDATE_CONFIG
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#gcp_integration_delete' do
|
53
|
+
it_behaves_like 'an api method',
|
54
|
+
:gcp_integration_delete, [CONFIG],
|
55
|
+
:delete, '/integration/gcp', CONFIG
|
56
|
+
end
|
57
|
+
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
|
@@ -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
|
@@ -27,12 +31,37 @@ describe Dogapi::Client do
|
|
27
31
|
:get, "/monitor/#{MONITOR_ID}", group_states: %w(custom all)
|
28
32
|
end
|
29
33
|
|
34
|
+
describe '#can_delete_monitors' do
|
35
|
+
context 'with one id' do
|
36
|
+
it_behaves_like 'an api method',
|
37
|
+
:can_delete_monitors, [MONITOR_ID],
|
38
|
+
:get, '/monitor/can_delete'
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'with multiple ids' do
|
42
|
+
it_behaves_like 'an api method',
|
43
|
+
:can_delete_monitors, [[MONITOR_ID, MONITOR_ID + 1, MONITOR_ID + 2]],
|
44
|
+
:get, '/monitor/can_delete'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
30
48
|
describe '#delete_monitor' do
|
31
49
|
it_behaves_like 'an api method',
|
32
50
|
:delete_monitor, [MONITOR_ID],
|
33
51
|
:delete, "/monitor/#{MONITOR_ID}"
|
34
52
|
end
|
35
53
|
|
54
|
+
describe '#delete_monitor with options' do
|
55
|
+
it 'queries the api with options' do
|
56
|
+
url = api_url + "/monitor/#{MONITOR_ID}?force=true"
|
57
|
+
options = { 'force' => true }
|
58
|
+
stub_request(:delete, url).to_return(body: '{}').then.to_raise(StandardError)
|
59
|
+
expect(dog.send(:delete_monitor, MONITOR_ID, options)).to eq ['200', {}]
|
60
|
+
|
61
|
+
expect(WebMock).to have_requested(:delete, url)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
36
65
|
describe '#get_all_monitors' do
|
37
66
|
it_behaves_like 'an api method with optional params',
|
38
67
|
:get_all_monitors, [],
|
@@ -102,7 +131,7 @@ describe Dogapi::Client do
|
|
102
131
|
describe '#cancel_downtime_by_scope' do
|
103
132
|
it_behaves_like 'an api method',
|
104
133
|
:cancel_downtime_by_scope, [DOWNTIME_SCOPE],
|
105
|
-
:post, '/downtime/cancel/by_scope'
|
134
|
+
:post, '/downtime/cancel/by_scope', 'scope' => DOWNTIME_SCOPE
|
106
135
|
end
|
107
136
|
|
108
137
|
describe '#get_all_downtimes' do
|