dogapi 1.38.0 → 1.39.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 +7 -4
- 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 +27 -32
- data/CHANGELOG.md +11 -0
- data/CONTRIBUTING.md +111 -0
- data/DEVELOPMENT.md +11 -0
- data/LICENSE +21 -20
- data/LICENSE-3rdparty.csv +6 -0
- data/README.rdoc +7 -0
- data/RELEASING.md +46 -0
- data/SUPPORT.md +9 -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 +44 -9
- data/lib/dogapi/event.rb +4 -0
- data/lib/dogapi/facade.rb +56 -8
- data/lib/dogapi/metric.rb +4 -0
- data/lib/dogapi/v1.rb +5 -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 +4 -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/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 +4 -0
- 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/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 +4 -0
- data/spec/unit/capistrano_spec.rb +4 -0
- data/spec/unit/common_spec.rb +41 -0
- data/spec/unit/facade_spec.rb +4 -0
- metadata +18 -4
data/lib/dogapi/event.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 'net/http'
|
2
6
|
|
3
7
|
require 'rubygems'
|
data/lib/dogapi/facade.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 'time'
|
2
6
|
require 'dogapi/v1'
|
3
7
|
require 'dogapi/v2'
|
@@ -90,6 +94,7 @@ module Dogapi
|
|
90
94
|
@embed_svc = Dogapi::V1::EmbedService.new(@api_key, @application_key, silent, timeout, @datadog_host)
|
91
95
|
@screenboard_svc = Dogapi::V1::ScreenboardService.new(@api_key, @application_key, silent, timeout, @datadog_host)
|
92
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)
|
93
98
|
@service_check_svc = Dogapi::V1::ServiceCheckService.new(@api_key, @application_key, silent, timeout, @datadog_host)
|
94
99
|
@metadata_svc = Dogapi::V1::MetadataService.new(@api_key, @application_key, silent, timeout, @datadog_host)
|
95
100
|
@legacy_event_svc = Dogapi::EventService.new(@datadog_host)
|
@@ -117,7 +122,7 @@ module Dogapi
|
|
117
122
|
# :device => String
|
118
123
|
# :options => Map
|
119
124
|
#
|
120
|
-
# options[:type] = "
|
125
|
+
# options[:type] = "count" to specify a counter metric
|
121
126
|
# options[:tags] = ["tag1", "tag2"] to tag the point
|
122
127
|
def emit_point(metric, value, options= {})
|
123
128
|
defaults = { :timestamp => Time.now }
|
@@ -139,7 +144,7 @@ module Dogapi
|
|
139
144
|
# :device => String
|
140
145
|
# :options => Map
|
141
146
|
#
|
142
|
-
# options[:type] = "
|
147
|
+
# options[:type] = "count" to specify a counter metric
|
143
148
|
# options[:tags] = ["tag1", "tag2"] to tag the point
|
144
149
|
def emit_points(metric, points, options= {})
|
145
150
|
scope = override_scope options
|
@@ -316,13 +321,13 @@ module Dogapi
|
|
316
321
|
#
|
317
322
|
|
318
323
|
# Create a dashboard.
|
319
|
-
def create_dashboard(title, description, graphs, template_variables=nil)
|
320
|
-
@dash_service.create_dashboard(title, description, graphs, template_variables)
|
324
|
+
def create_dashboard(title, description, graphs, template_variables = nil, read_only = false)
|
325
|
+
@dash_service.create_dashboard(title, description, graphs, template_variables, read_only)
|
321
326
|
end
|
322
327
|
|
323
328
|
# Update a dashboard.
|
324
|
-
def update_dashboard(dash_id, title, description, graphs, template_variables=nil)
|
325
|
-
@dash_service.update_dashboard(dash_id, title, description, graphs, template_variables)
|
329
|
+
def update_dashboard(dash_id, title, description, graphs, template_variables = nil, read_only = false)
|
330
|
+
@dash_service.update_dashboard(dash_id, title, description, graphs, template_variables, read_only)
|
326
331
|
end
|
327
332
|
|
328
333
|
# Fetch the given dashboard.
|
@@ -525,6 +530,49 @@ module Dogapi
|
|
525
530
|
@screenboard_svc.revoke_screenboard(board_id)
|
526
531
|
end
|
527
532
|
|
533
|
+
#
|
534
|
+
# SYNTHETICS
|
535
|
+
#
|
536
|
+
def create_synthetics_test(type, config, options = {})
|
537
|
+
@synthetics_svc.create_synthetics_test(type, config, options)
|
538
|
+
end
|
539
|
+
|
540
|
+
def update_synthetics_test(test_id, type, config, options = {})
|
541
|
+
@synthetics_svc.update_synthetics_test(test_id, type, config, options)
|
542
|
+
end
|
543
|
+
|
544
|
+
def delete_synthetics_tests(test_ids)
|
545
|
+
@synthetics_svc.delete_synthetics_tests(test_ids)
|
546
|
+
end
|
547
|
+
|
548
|
+
def start_pause_synthetics_test(test_id, new_status)
|
549
|
+
@synthetics_svc.start_pause_synthetics_test(test_id, new_status)
|
550
|
+
end
|
551
|
+
|
552
|
+
def get_all_synthetics_tests
|
553
|
+
@synthetics_svc.get_all_synthetics_tests()
|
554
|
+
end
|
555
|
+
|
556
|
+
def get_synthetics_test(test_id)
|
557
|
+
@synthetics_svc.get_synthetics_test(test_id)
|
558
|
+
end
|
559
|
+
|
560
|
+
def get_synthetics_results(test_id)
|
561
|
+
@synthetics_svc.get_synthetics_results(test_id)
|
562
|
+
end
|
563
|
+
|
564
|
+
def get_synthetics_result(test_id, result_id)
|
565
|
+
@synthetics_svc.get_synthetics_result(test_id, result_id)
|
566
|
+
end
|
567
|
+
|
568
|
+
def get_synthetics_devices
|
569
|
+
@synthetics_svc.get_synthetics_devices()
|
570
|
+
end
|
571
|
+
|
572
|
+
def get_synthetics_locations
|
573
|
+
@synthetics_svc.get_synthetics_locations()
|
574
|
+
end
|
575
|
+
|
528
576
|
#
|
529
577
|
# MONITORS
|
530
578
|
#
|
@@ -545,8 +593,8 @@ module Dogapi
|
|
545
593
|
@monitor_svc.can_delete_monitors(monitor_ids)
|
546
594
|
end
|
547
595
|
|
548
|
-
def delete_monitor(monitor_id)
|
549
|
-
@monitor_svc.delete_monitor(monitor_id)
|
596
|
+
def delete_monitor(monitor_id, options = {})
|
597
|
+
@monitor_svc.delete_monitor(monitor_id, options)
|
550
598
|
end
|
551
599
|
|
552
600
|
def get_all_monitors(options= {})
|
data/lib/dogapi/metric.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 'net/http'
|
2
6
|
|
3
7
|
require 'rubygems'
|
data/lib/dogapi/v1.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 'dogapi/v1/alert'
|
2
6
|
require 'dogapi/v1/comment'
|
3
7
|
require 'dogapi/v1/dash'
|
@@ -12,6 +16,7 @@ require 'dogapi/v1/screenboard'
|
|
12
16
|
require 'dogapi/v1/search'
|
13
17
|
require 'dogapi/v1/service_check'
|
14
18
|
require 'dogapi/v1/snapshot'
|
19
|
+
require 'dogapi/v1/synthetics'
|
15
20
|
require 'dogapi/v1/tag'
|
16
21
|
require 'dogapi/v1/user'
|
17
22
|
require 'dogapi/v1/hosts'
|
data/lib/dogapi/v1/alert.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 '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
|
data/lib/dogapi/v1/aws_logs.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 '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
|
data/lib/dogapi/v1/comment.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 'dogapi'
|
2
6
|
|
3
7
|
module Dogapi
|
data/lib/dogapi/v1/dash.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 'dogapi'
|
2
6
|
|
3
7
|
module Dogapi
|
@@ -7,23 +11,25 @@ module Dogapi
|
|
7
11
|
|
8
12
|
API_VERSION = 'v1'
|
9
13
|
|
10
|
-
def create_dashboard(title, description, graphs, template_variables = nil)
|
14
|
+
def create_dashboard(title, description, graphs, template_variables = nil, read_only = false)
|
11
15
|
body = {
|
12
16
|
:title => title,
|
13
17
|
:description => description,
|
14
18
|
:graphs => graphs,
|
15
|
-
:template_variables => (template_variables or [])
|
19
|
+
:template_variables => (template_variables or []),
|
20
|
+
:read_only => read_only
|
16
21
|
}
|
17
22
|
|
18
23
|
request(Net::HTTP::Post, "/api/#{API_VERSION}/dash", nil, body, true)
|
19
24
|
end
|
20
25
|
|
21
|
-
def update_dashboard(dash_id, title, description, graphs, template_variables=nil)
|
26
|
+
def update_dashboard(dash_id, title, description, graphs, template_variables = nil, read_only = false)
|
22
27
|
body = {
|
23
28
|
:title => title,
|
24
29
|
:description => description,
|
25
30
|
:graphs => graphs,
|
26
|
-
:template_variables => (template_variables or [])
|
31
|
+
:template_variables => (template_variables or []),
|
32
|
+
:read_only => read_only
|
27
33
|
}
|
28
34
|
|
29
35
|
request(Net::HTTP::Put, "/api/#{API_VERSION}/dash/#{dash_id}", nil, body, true)
|
data/lib/dogapi/v1/dashboard.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 '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
|
data/lib/dogapi/v1/embed.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 'dogapi'
|
2
6
|
|
3
7
|
module Dogapi
|
data/lib/dogapi/v1/event.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 '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
|
data/lib/dogapi/v1/hosts.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 '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
|
data/lib/dogapi/v1/metadata.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 'dogapi'
|
2
6
|
|
3
7
|
module Dogapi
|
data/lib/dogapi/v1/metric.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 'dogapi'
|
2
6
|
|
3
7
|
module Dogapi
|
data/lib/dogapi/v1/monitor.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 'dogapi'
|
2
6
|
|
3
7
|
module Dogapi
|
@@ -51,8 +55,8 @@ module Dogapi
|
|
51
55
|
request(Net::HTTP::Get, "/api/#{API_VERSION}/monitor/can_delete", extra_params, nil, false)
|
52
56
|
end
|
53
57
|
|
54
|
-
def delete_monitor(monitor_id)
|
55
|
-
request(Net::HTTP::Delete, "/api/#{API_VERSION}/monitor/#{monitor_id}",
|
58
|
+
def delete_monitor(monitor_id, options = {})
|
59
|
+
request(Net::HTTP::Delete, "/api/#{API_VERSION}/monitor/#{monitor_id}", options, nil, false)
|
56
60
|
end
|
57
61
|
|
58
62
|
def get_all_monitors(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
|
data/lib/dogapi/v1/search.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 '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
|
data/lib/dogapi/v1/snapshot.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 '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
|
data/lib/dogapi/v1/tag.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 'dogapi'
|
2
6
|
|
3
7
|
module Dogapi
|