dogapi 1.5.2 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +6 -2
- data/lib/dogapi/facade.rb +10 -10
- data/lib/dogapi/v1/tag.rb +23 -5
- metadata +57 -43
data/README.rdoc
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
-
= Ruby client for Datadog API v1.
|
1
|
+
= Ruby client for Datadog API v1.6.0
|
2
2
|
|
3
3
|
The Ruby client is a library suitable for inclusion in existing Ruby projects or for development of standalone scripts. It provides an abstraction on top of Datadog's raw HTTP interface for reporting events and metrics.
|
4
4
|
|
5
5
|
= What's new?
|
6
6
|
|
7
|
-
== v1.
|
7
|
+
== v1.6.0
|
8
|
+
|
9
|
+
* Support for setting `source` type when submitting host tags
|
10
|
+
|
11
|
+
== v1.5.2
|
8
12
|
* Fix a bug in hashing the Event object when the instance variables are symbols.
|
9
13
|
|
10
14
|
== v1.5.0
|
data/lib/dogapi/facade.rb
CHANGED
@@ -170,15 +170,15 @@ module Dogapi
|
|
170
170
|
#
|
171
171
|
|
172
172
|
# Get all tags and their associated hosts at your org
|
173
|
-
def all_tags()
|
174
|
-
@tag_svc.get_all()
|
173
|
+
def all_tags(source=nil)
|
174
|
+
@tag_svc.get_all(source)
|
175
175
|
end
|
176
176
|
|
177
177
|
# Get all tags for the given host
|
178
178
|
#
|
179
179
|
# +host_id+ can be the host's numeric id or string name
|
180
|
-
def host_tags(host_id)
|
181
|
-
@tag_svc.get(host_id)
|
180
|
+
def host_tags(host_id, source=nil, by_source=false)
|
181
|
+
@tag_svc.get(host_id, source, by_source)
|
182
182
|
end
|
183
183
|
|
184
184
|
# Add the tags to the given host
|
@@ -186,8 +186,8 @@ module Dogapi
|
|
186
186
|
# +host_id+ can be the host's numeric id or string name
|
187
187
|
#
|
188
188
|
# +tags+ is and Array of Strings
|
189
|
-
def add_tags(host_id, tags)
|
190
|
-
@tag_svc.add(host_id, tags)
|
189
|
+
def add_tags(host_id, tags, source=nil)
|
190
|
+
@tag_svc.add(host_id, tags, source)
|
191
191
|
end
|
192
192
|
|
193
193
|
# Replace the tags on the given host
|
@@ -195,8 +195,8 @@ module Dogapi
|
|
195
195
|
# +host_id+ can be the host's numeric id or string name
|
196
196
|
#
|
197
197
|
# +tags+ is and Array of Strings
|
198
|
-
def update_tags(host_id, tags)
|
199
|
-
@tag_svc.update(host_id, tags)
|
198
|
+
def update_tags(host_id, tags, source=nil)
|
199
|
+
@tag_svc.update(host_id, tags, source)
|
200
200
|
end
|
201
201
|
|
202
202
|
# <b>DEPRECATED:</b> Spelling mistake temporarily preserved as an alias.
|
@@ -208,8 +208,8 @@ module Dogapi
|
|
208
208
|
# Remove all tags from the given host
|
209
209
|
#
|
210
210
|
# +host_id+ can be the host's numeric id or string name
|
211
|
-
def detach_tags(host_id)
|
212
|
-
@tag_svc.detach(host_id)
|
211
|
+
def detach_tags(host_id, source=nil)
|
212
|
+
@tag_svc.detach(host_id, source)
|
213
213
|
end
|
214
214
|
|
215
215
|
#
|
data/lib/dogapi/v1/tag.rb
CHANGED
@@ -9,12 +9,15 @@ module Dogapi
|
|
9
9
|
API_VERSION = "v1"
|
10
10
|
|
11
11
|
# Gets all tags in your org and the hosts tagged with them
|
12
|
-
def get_all()
|
12
|
+
def get_all(source=nil)
|
13
13
|
begin
|
14
14
|
params = {
|
15
15
|
:api_key => @api_key,
|
16
16
|
:application_key => @application_key
|
17
17
|
}
|
18
|
+
if source
|
19
|
+
params['source'] = source
|
20
|
+
end
|
18
21
|
|
19
22
|
request(Net::HTTP::Get, '/api/' + API_VERSION + '/tags/hosts', params, nil, false)
|
20
23
|
rescue Exception => e
|
@@ -28,12 +31,18 @@ module Dogapi
|
|
28
31
|
end
|
29
32
|
|
30
33
|
# Gets all tags for a given host
|
31
|
-
def get(host_id)
|
34
|
+
def get(host_id, source=nil, by_source=false)
|
32
35
|
begin
|
33
36
|
params = {
|
34
37
|
:api_key => @api_key,
|
35
38
|
:application_key => @application_key
|
36
39
|
}
|
40
|
+
if source
|
41
|
+
params['source'] = source
|
42
|
+
end
|
43
|
+
if by_source
|
44
|
+
params['by_source'] = 'true'
|
45
|
+
end
|
37
46
|
|
38
47
|
request(Net::HTTP::Get, '/api/' + API_VERSION + '/tags/hosts/' + host_id.to_s, params, nil, false)
|
39
48
|
rescue Exception => e
|
@@ -47,12 +56,15 @@ module Dogapi
|
|
47
56
|
end
|
48
57
|
|
49
58
|
# Adds a list of tags to a host
|
50
|
-
def add(host_id, tags)
|
59
|
+
def add(host_id, tags, source=nil)
|
51
60
|
begin
|
52
61
|
params = {
|
53
62
|
:api_key => @api_key,
|
54
63
|
:application_key => @application_key
|
55
64
|
}
|
65
|
+
if source
|
66
|
+
params['source'] = source
|
67
|
+
end
|
56
68
|
|
57
69
|
body = {
|
58
70
|
:tags => tags
|
@@ -70,12 +82,15 @@ module Dogapi
|
|
70
82
|
end
|
71
83
|
|
72
84
|
# Remove all tags from a host and replace them with a new list
|
73
|
-
def update(host_id, tags)
|
85
|
+
def update(host_id, tags, source=nil)
|
74
86
|
begin
|
75
87
|
params = {
|
76
88
|
:api_key => @api_key,
|
77
89
|
:application_key => @application_key
|
78
90
|
}
|
91
|
+
if source
|
92
|
+
params['source'] = source
|
93
|
+
end
|
79
94
|
|
80
95
|
body = {
|
81
96
|
:tags => tags
|
@@ -99,12 +114,15 @@ module Dogapi
|
|
99
114
|
end
|
100
115
|
|
101
116
|
# Remove all tags from a host
|
102
|
-
def detach(host_id)
|
117
|
+
def detach(host_id, source=nil)
|
103
118
|
begin
|
104
119
|
params = {
|
105
120
|
:api_key => @api_key,
|
106
121
|
:application_key => @application_key
|
107
122
|
}
|
123
|
+
if source
|
124
|
+
params['source'] = source
|
125
|
+
end
|
108
126
|
|
109
127
|
request(Net::HTTP::Delete, '/api/' + API_VERSION + '/tags/hosts/' + host_id.to_s, params, nil, false)
|
110
128
|
rescue Exception => e
|
metadata
CHANGED
@@ -1,47 +1,53 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: dogapi
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 6
|
8
|
+
- 0
|
9
|
+
segments_generated: true
|
10
|
+
version: 1.6.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Datadog, Inc.
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 1.5.1
|
17
|
+
|
18
|
+
date: 2013-02-19 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
22
|
type: :runtime
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 5
|
30
|
+
- 1
|
31
|
+
segments_generated: true
|
29
32
|
version: 1.5.1
|
33
|
+
name: json
|
34
|
+
requirement: *id001
|
35
|
+
prerelease: false
|
30
36
|
description:
|
31
37
|
email: packages@datadoghq.com
|
32
38
|
executables: []
|
39
|
+
|
33
40
|
extensions: []
|
34
|
-
|
41
|
+
|
42
|
+
extra_rdoc_files:
|
35
43
|
- README.rdoc
|
36
|
-
files:
|
37
|
-
- lib/capistrano/README.md
|
44
|
+
files:
|
38
45
|
- lib/capistrano/datadog.rb
|
39
|
-
- lib/
|
46
|
+
- lib/capistrano/README.md
|
40
47
|
- lib/dogapi/common.rb
|
41
48
|
- lib/dogapi/event.rb
|
42
49
|
- lib/dogapi/facade.rb
|
43
50
|
- lib/dogapi/metric.rb
|
44
|
-
- lib/dogapi/v1.rb
|
45
51
|
- lib/dogapi/v1/alert.rb
|
46
52
|
- lib/dogapi/v1/comment.rb
|
47
53
|
- lib/dogapi/v1/dash.rb
|
@@ -49,6 +55,8 @@ files:
|
|
49
55
|
- lib/dogapi/v1/metric.rb
|
50
56
|
- lib/dogapi/v1/search.rb
|
51
57
|
- lib/dogapi/v1/tag.rb
|
58
|
+
- lib/dogapi/v1.rb
|
59
|
+
- lib/dogapi.rb
|
52
60
|
- tests/test_alerts.rb
|
53
61
|
- tests/test_base.rb
|
54
62
|
- tests/test_client.rb
|
@@ -56,36 +64,42 @@ files:
|
|
56
64
|
- tests/test_dashes.rb
|
57
65
|
- tests/test_search.rb
|
58
66
|
- README.rdoc
|
67
|
+
has_rdoc: true
|
59
68
|
homepage: http://datadoghq.com/
|
60
|
-
licenses:
|
69
|
+
licenses:
|
61
70
|
- BSD
|
62
71
|
post_install_message:
|
63
|
-
rdoc_options:
|
72
|
+
rdoc_options:
|
64
73
|
- --title
|
65
74
|
- DogAPI -- DataDog Client
|
66
75
|
- --main
|
67
76
|
- README.rdoc
|
68
77
|
- --line-numbers
|
69
78
|
- --inline-source
|
70
|
-
require_paths:
|
79
|
+
require_paths:
|
71
80
|
- lib
|
72
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
segments_generated: true
|
88
|
+
version: "0"
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
segments_generated: true
|
96
|
+
version: "0"
|
84
97
|
requirements: []
|
98
|
+
|
85
99
|
rubyforge_project:
|
86
|
-
rubygems_version: 1.
|
100
|
+
rubygems_version: 1.3.6
|
87
101
|
signing_key:
|
88
102
|
specification_version: 3
|
89
103
|
summary: Ruby bindings for Datadog's API
|
90
|
-
test_files:
|
104
|
+
test_files:
|
91
105
|
- tests/test_client.rb
|