wavefront-sdk 0.0.1 → 0.1.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/Gemfile.lock +4 -1
- data/README.md +32 -10
- data/lib/wavefront-sdk/alert.rb +21 -26
- data/lib/wavefront-sdk/base.rb +20 -16
- data/lib/wavefront-sdk/cloudintegration.rb +5 -11
- data/lib/wavefront-sdk/credentials.rb +14 -4
- data/lib/wavefront-sdk/dashboard.rb +14 -20
- data/lib/wavefront-sdk/event.rb +15 -22
- data/lib/wavefront-sdk/exception.rb +1 -1
- data/lib/wavefront-sdk/externallink.rb +6 -14
- data/lib/wavefront-sdk/maintenancewindow.rb +4 -10
- data/lib/wavefront-sdk/message.rb +3 -9
- data/lib/wavefront-sdk/metric.rb +4 -20
- data/lib/wavefront-sdk/proxy.rb +5 -11
- data/lib/wavefront-sdk/query.rb +4 -21
- data/lib/wavefront-sdk/response.rb +65 -37
- data/lib/wavefront-sdk/savedsearch.rb +5 -11
- data/lib/wavefront-sdk/search.rb +1 -7
- data/lib/wavefront-sdk/source.rb +12 -18
- data/lib/wavefront-sdk/user.rb +14 -23
- data/lib/wavefront-sdk/validators.rb +2 -2
- data/lib/wavefront-sdk/version.rb +1 -1
- data/lib/wavefront-sdk/webhook.rb +4 -10
- data/lib/wavefront-sdk/write.rb +25 -15
- data/spec/wavefront-sdk/credentials_spec.rb +12 -12
- data/spec/wavefront-sdk/response_spec.rb +10 -10
- data/spec/wavefront-sdk/validators_spec.rb +1 -1
- data/wavefront-sdk.gemspec +2 -0
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a04d6dc9514eea460313e7caa056b80e679df99
|
4
|
+
data.tar.gz: 4c702f5ec963fa951c5d5b59b916784c12c4f9ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecb2531e3b9e2507679abec131ac65d3688c3c959cace5203fe78853d6dec16358687221dc5500701b1d1cc5ec21835b81739a75d51a4720aaf033401eadad9b
|
7
|
+
data.tar.gz: ad79ef3b12a11f635bf0a6ab00e3c53aae58ce94a7885811fe13eba1fe59240f36abc2844faf46db73badfe97a165acd6254c33aff4b784df12d24dd4ae362ea
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wavefront-sdk (0.0
|
4
|
+
wavefront-sdk (0.1.0)
|
5
|
+
addressable (~> 2.4)
|
5
6
|
faraday (>= 0.12.1, < 0.13)
|
6
7
|
inifile (>= 3.0.0)
|
8
|
+
map (~> 6.6.0)
|
7
9
|
|
8
10
|
GEM
|
9
11
|
remote: https://rubygems.org/
|
@@ -17,6 +19,7 @@ GEM
|
|
17
19
|
multipart-post (>= 1.2, < 3)
|
18
20
|
hashdiff (0.3.2)
|
19
21
|
inifile (3.0.0)
|
22
|
+
map (6.6.0)
|
20
23
|
minitest (5.8.5)
|
21
24
|
multipart-post (2.0.0)
|
22
25
|
parser (2.4.0.0)
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# wavefront-sdk [](https://travis-ci.org/snltd/wavefront-sdk) [](https://codeclimate.com/github/snltd/wavefront-sdk) [](https://codeclimate.com/github/snltd/wavefront-sdk) [](https://snyk.io/test/github/snltd/wavefront-sdk)
|
1
|
+
# wavefront-sdk [](https://travis-ci.org/snltd/wavefront-sdk) [](https://codeclimate.com/github/snltd/wavefront-sdk) [](https://codeclimate.com/github/snltd/wavefront-sdk) [](https://snyk.io/test/github/snltd/wavefront-sdk) [](https://badge.fury.io/rb/wavefront-sdk) 
|
2
2
|
|
3
3
|
This is a Ruby SDK for v2 of
|
4
4
|
[Wavefront](https://www.wavefront.com/)'s public API. It supports Ruby >= 2.2.
|
@@ -15,15 +15,29 @@ $ gem install wavefront-sdk
|
|
15
15
|
|
16
16
|
or to build locally,
|
17
17
|
|
18
|
-
|
18
|
+
|
19
19
|
$ gem build wavefront-sdk.gemspec
|
20
20
|
```
|
21
21
|
|
22
|
+
## Documentation
|
23
|
+
|
24
|
+
The code is documented with [YARD](http://yardoc.org/) and
|
25
|
+
automatically generated documentation is [available on
|
26
|
+
rubydoc.info](http://www.rubydoc.info/gems/wavefront-sdk/).
|
27
|
+
|
22
28
|
## Examples
|
23
29
|
|
24
30
|
First, let's list the IDs of the users in our account. The `list()` method
|
25
|
-
will return a `Wavefront::Response
|
26
|
-
response
|
31
|
+
will return a `Wavefront::Response` object. This object has
|
32
|
+
`status` and `response` methods. `status` always yields a
|
33
|
+
structure containing `result`, `message` and `code` fields which can
|
34
|
+
be inspected to ensure an API call was processed successfully.
|
35
|
+
`response` gives you a the JSON response from the API, conveniently
|
36
|
+
processed and turned into a
|
37
|
+
[`Map`](https://github.com/ahoward/map) object. Map objects can be
|
38
|
+
interrogated in various ways. For instance `map['items']`,
|
39
|
+
`map[:items]` and `map.items` will all get you to the same place.
|
40
|
+
|
27
41
|
|
28
42
|
```ruby
|
29
43
|
# Define our API endpoint. (This is not a valid token!)
|
@@ -41,16 +55,24 @@ log = Logger.new(STDOUT)
|
|
41
55
|
|
42
56
|
wf = Wavefront::User.new(CREDS, verbose: true, logger: log)
|
43
57
|
|
58
|
+
# See how things went:
|
59
|
+
|
60
|
+
p wf.status
|
61
|
+
#<Wavefront::Type::Status:0x007feb99185538 @result="OK", @message="", @code=200>
|
62
|
+
|
63
|
+
# And print each user's ID
|
64
|
+
|
44
65
|
wf.list.response.items.each { |user| puts user[:identifier] }
|
45
66
|
|
46
|
-
#
|
67
|
+
# Now delete the user 'lolex@oldplace.com', disregarding the
|
68
|
+
# response.
|
47
69
|
|
48
70
|
wf.delete('lolex@oldplace.com')
|
49
71
|
```
|
50
72
|
|
51
73
|
Retrieve a timeseries over the last 10 minutes, with one minute bucket
|
52
74
|
granularity. We will describe the time as a Ruby object, but could also use
|
53
|
-
an epoch timestamp.
|
75
|
+
an epoch timestamp. The SDK happily converts between the two.
|
54
76
|
|
55
77
|
|
56
78
|
```ruby
|
@@ -63,9 +85,9 @@ Wavefront::Query.new(CREDS).query(
|
|
63
85
|
)
|
64
86
|
```
|
65
87
|
|
66
|
-
We can write points too, assuming we have a proxy
|
67
|
-
directly via the API. Unlike all other classes, this
|
68
|
-
address and port as its credential hash.
|
88
|
+
We can write points too, assuming we have access to a proxy, because
|
89
|
+
you can't write points directly via the API. Unlike all other classes, this
|
90
|
+
one requires the proxy address and port as its credential hash.
|
69
91
|
|
70
92
|
```ruby
|
71
93
|
require 'wavefront-sdk/write'
|
@@ -77,7 +99,7 @@ wf = Wavefront::Write.new(W_CREDS, debug: true)
|
|
77
99
|
task = wf.write( [{ path: 'dev.test.sdk', value: 10 }])
|
78
100
|
|
79
101
|
p task.response
|
80
|
-
|
102
|
+
#{"sent"=>1, "rejected"=>0, "unsent"=>0}
|
81
103
|
puts task.status.result
|
82
104
|
#OK
|
83
105
|
```
|
data/lib/wavefront-sdk/alert.rb
CHANGED
@@ -5,7 +5,7 @@ module Wavefront
|
|
5
5
|
# View and manage alerts. Alerts are identified by their millisecond
|
6
6
|
# epoch timestamp. Returns a Wavefront::Response::Alert object.
|
7
7
|
#
|
8
|
-
class Alert <
|
8
|
+
class Alert < Base
|
9
9
|
|
10
10
|
# GET /api/v2/alert
|
11
11
|
# Get all alerts for a customer
|
@@ -31,7 +31,7 @@ module Wavefront
|
|
31
31
|
api_post('', body, 'application/json')
|
32
32
|
end
|
33
33
|
|
34
|
-
# DELETE /api/v2/alert/
|
34
|
+
# DELETE /api/v2/alert/id
|
35
35
|
# Delete a specific alert.
|
36
36
|
#
|
37
37
|
# Deleting an active alert moves it to 'trash', from where it can
|
@@ -46,8 +46,8 @@ module Wavefront
|
|
46
46
|
api_delete(id)
|
47
47
|
end
|
48
48
|
|
49
|
-
# GET /api/v2/alert/
|
50
|
-
# GET /api/v2/alert/
|
49
|
+
# GET /api/v2/alert/id
|
50
|
+
# GET /api/v2/alert/id/history/version
|
51
51
|
# Get a specific alert / Get a specific historical version of a
|
52
52
|
# specific alert.
|
53
53
|
#
|
@@ -63,7 +63,7 @@ module Wavefront
|
|
63
63
|
api_get(fragments.uri_concat)
|
64
64
|
end
|
65
65
|
|
66
|
-
# PUT /api/v2/alert/
|
66
|
+
# PUT /api/v2/alert/id
|
67
67
|
# Update a specific alert.
|
68
68
|
#
|
69
69
|
# @param id [String] a Wavefront alert ID
|
@@ -76,7 +76,7 @@ module Wavefront
|
|
76
76
|
api_put(id, body, 'application/json')
|
77
77
|
end
|
78
78
|
|
79
|
-
# GET /api/v2/alert/
|
79
|
+
# GET /api/v2/alert/id/history
|
80
80
|
# Get the version history of a specific alert.
|
81
81
|
#
|
82
82
|
# @param id [String] ID of the alert
|
@@ -87,12 +87,13 @@ module Wavefront
|
|
87
87
|
api_get([id, 'history'].uri_concat)
|
88
88
|
end
|
89
89
|
|
90
|
-
# POST /api/v2/alert/
|
90
|
+
# POST /api/v2/alert/id/snooze
|
91
91
|
# Snooze a specific alert for some number of seconds.
|
92
92
|
#
|
93
93
|
# @param id [String] ID of the alert
|
94
|
-
# @param
|
95
|
-
#
|
94
|
+
# @param seconds [Integer] how many seconds to snooze for.
|
95
|
+
# Nil is indefinite
|
96
|
+
# @return [Hash] object describing the alert with status and
|
96
97
|
# response keys
|
97
98
|
#
|
98
99
|
def snooze(id, seconds = nil)
|
@@ -101,11 +102,11 @@ module Wavefront
|
|
101
102
|
api_post([id, "snooze#{qs}"].uri_concat, nil)
|
102
103
|
end
|
103
104
|
|
104
|
-
# GET /api/v2/alert/
|
105
|
+
# GET /api/v2/alert/id/tag
|
105
106
|
# Get all tags associated with a specific alert.
|
106
107
|
#
|
107
108
|
# @param id [String] ID of the alert
|
108
|
-
# @
|
109
|
+
# @return [Hash] object describing the alert with status and
|
109
110
|
# response keys
|
110
111
|
#
|
111
112
|
def tags(id)
|
@@ -113,12 +114,12 @@ module Wavefront
|
|
113
114
|
api_get([id, 'tag'].uri_concat)
|
114
115
|
end
|
115
116
|
|
116
|
-
# POST /api/v2/alert/
|
117
|
+
# POST /api/v2/alert/id/tag
|
117
118
|
# Set all tags associated with a specific alert.
|
118
119
|
#
|
119
120
|
# @param id [String] ID of the alert
|
120
121
|
# @param tags [Array] list of tags to set.
|
121
|
-
# @
|
122
|
+
# @return [Hash] object describing the alert with status and
|
122
123
|
# response keys
|
123
124
|
#
|
124
125
|
def tag_set(id, tags)
|
@@ -128,12 +129,12 @@ module Wavefront
|
|
128
129
|
api_post([id, 'tag'].uri_concat, tags.to_json, 'application/json')
|
129
130
|
end
|
130
131
|
|
131
|
-
# DELETE /api/v2/alert/
|
132
|
+
# DELETE /api/v2/alert/id/tag/tagValue
|
132
133
|
# Remove a tag from a specific alert.
|
133
134
|
#
|
134
135
|
# @param id [String] ID of the alert
|
135
136
|
# @param tag [String] tag to delete
|
136
|
-
# @
|
137
|
+
# @return [Hash] object with 'status' key and empty 'repsonse'
|
137
138
|
#
|
138
139
|
def tag_delete(id, tag)
|
139
140
|
wf_alert_id?(id)
|
@@ -141,12 +142,12 @@ module Wavefront
|
|
141
142
|
api_delete([id, 'tag', tag].uri_concat)
|
142
143
|
end
|
143
144
|
|
144
|
-
# PUT /api/v2/alert/
|
145
|
+
# PUT /api/v2/alert/id/tag/tagValue
|
145
146
|
# Add a tag to a specific alert.
|
146
147
|
#
|
147
148
|
# @param id [String] ID of the alert
|
148
149
|
# @param tag [String] tag to set.
|
149
|
-
# @
|
150
|
+
# @return [Hash] object with 'status' key and empty 'repsonse'
|
150
151
|
#
|
151
152
|
def tag_add(id, tag)
|
152
153
|
wf_alert_id?(id)
|
@@ -154,7 +155,7 @@ module Wavefront
|
|
154
155
|
api_put([id, 'tag', tag].uri_concat)
|
155
156
|
end
|
156
157
|
|
157
|
-
# POST /api/v2/alert/
|
158
|
+
# POST /api/v2/alert/id/undelete
|
158
159
|
# Undelete a specific alert.
|
159
160
|
#
|
160
161
|
# @param id [String] ID of the alert
|
@@ -165,11 +166,11 @@ module Wavefront
|
|
165
166
|
api_post([id, 'undelete'].uri_concat)
|
166
167
|
end
|
167
168
|
|
168
|
-
# POST /api/v2/alert/
|
169
|
+
# POST /api/v2/alert/id/unsnooze
|
169
170
|
# Unsnooze a specific alert.
|
170
171
|
#
|
171
172
|
# @param id [String] ID of the alert
|
172
|
-
# @
|
173
|
+
# @return [Hash] object describing the alert with status and
|
173
174
|
# response keys
|
174
175
|
#
|
175
176
|
def unsnooze(id)
|
@@ -186,10 +187,4 @@ module Wavefront
|
|
186
187
|
api_get('summary')
|
187
188
|
end
|
188
189
|
end
|
189
|
-
|
190
|
-
# A standard response
|
191
|
-
#
|
192
|
-
class Response
|
193
|
-
class Alert < Base; end
|
194
|
-
end
|
195
190
|
end
|
data/lib/wavefront-sdk/base.rb
CHANGED
@@ -3,6 +3,7 @@ require 'time'
|
|
3
3
|
require 'faraday'
|
4
4
|
require 'pp'
|
5
5
|
require 'ostruct'
|
6
|
+
require 'addressable'
|
6
7
|
require_relative './exception'
|
7
8
|
require_relative './mixins'
|
8
9
|
require_relative './response'
|
@@ -15,8 +16,7 @@ module Wavefront
|
|
15
16
|
# any call to the Wavefront API from this SDK, you are returned an
|
16
17
|
# OpenStruct object.
|
17
18
|
#
|
18
|
-
# @
|
19
|
-
# the inheriting class name.
|
19
|
+
# @return a Wavefront::Response object
|
20
20
|
#
|
21
21
|
class Base
|
22
22
|
include Wavefront::Validators
|
@@ -85,8 +85,8 @@ module Wavefront
|
|
85
85
|
#
|
86
86
|
def mk_conn(path, headers = {})
|
87
87
|
Faraday.new(
|
88
|
-
url: "https://#{net[:endpoint]}" +
|
89
|
-
[net[:api_base], path].uri_concat,
|
88
|
+
url: Addressable::URI.encode("https://#{net[:endpoint]}" +
|
89
|
+
[net[:api_base], path].uri_concat),
|
90
90
|
headers: net[:headers].merge(headers)
|
91
91
|
)
|
92
92
|
end
|
@@ -98,7 +98,8 @@ module Wavefront
|
|
98
98
|
#
|
99
99
|
# @param path [String] path to be appended to the
|
100
100
|
# #net[:api_base] path.
|
101
|
-
# @param
|
101
|
+
# @param query [Hash] optional key-value pairs with will be made
|
102
|
+
# into aquery string
|
102
103
|
# @return [Hash] API response
|
103
104
|
#
|
104
105
|
def api_get(path, query = {})
|
@@ -154,11 +155,12 @@ module Wavefront
|
|
154
155
|
end
|
155
156
|
|
156
157
|
# doing a PUT to update an object requires only a certain subset of
|
157
|
-
# the keys returned by #describe().
|
158
|
+
# the keys returned by #describe(). This method takes the
|
159
|
+
# existing description of an object and turns it into a new has
|
160
|
+
# which can be PUT.
|
158
161
|
#
|
159
|
-
# @param
|
160
|
-
#
|
161
|
-
# @param keys [Array, String] the keys(s) the user wishes to update
|
162
|
+
# @param old [Hash] a hash of the existing object
|
163
|
+
# @param new [Hash] the keys you wish to update
|
162
164
|
# @return [Hash] a hash containing only the keys which need to be
|
163
165
|
# sent to the API. Keys will be symbolized.
|
164
166
|
#
|
@@ -187,13 +189,20 @@ module Wavefront
|
|
187
189
|
#
|
188
190
|
return if level == :debug && ! opts[:debug]
|
189
191
|
return if level == :info && ! opts[:verbose]
|
190
|
-
|
191
192
|
puts msg
|
192
193
|
end
|
193
194
|
end
|
194
195
|
|
196
|
+
# If we need to massage a raw response to fit what the
|
197
|
+
# Wavefront::Response class expects (I'm looking at you,
|
198
|
+
# 'User'), a class can provide a {#response_shim} method.
|
199
|
+
#
|
195
200
|
def respond(resp)
|
196
|
-
|
201
|
+
body = respond_to?(:response_shim) ? response_shim(resp.body,
|
202
|
+
resp.status) :
|
203
|
+
resp.body
|
204
|
+
|
205
|
+
Wavefront::Response.new(body, resp.status)
|
197
206
|
end
|
198
207
|
|
199
208
|
private
|
@@ -226,11 +235,6 @@ module Wavefront
|
|
226
235
|
respond(resp)
|
227
236
|
end
|
228
237
|
|
229
|
-
def response_class
|
230
|
-
Object.const_get(
|
231
|
-
"Wavefront::Response::#{self.class.name.split('::').last}")
|
232
|
-
end
|
233
|
-
|
234
238
|
def setup_endpoint(creds)
|
235
239
|
%w(endpoint token).each do |k|
|
236
240
|
raise "creds must contain #{k}" unless creds.key?(k.to_sym)
|
@@ -5,7 +5,7 @@ module Wavefront
|
|
5
5
|
# View and manage Cloud Integrations. These are identified by
|
6
6
|
# a UUID.
|
7
7
|
#
|
8
|
-
class CloudIntegration <
|
8
|
+
class CloudIntegration < Base
|
9
9
|
|
10
10
|
# GET /api/v2/cloudintegration
|
11
11
|
# Get all cloud integrations for a customer
|
@@ -30,7 +30,7 @@ module Wavefront
|
|
30
30
|
api_post('', body, 'application/json')
|
31
31
|
end
|
32
32
|
|
33
|
-
# DELETE /api/v2/cloudintegration/
|
33
|
+
# DELETE /api/v2/cloudintegration/id
|
34
34
|
# Delete a specific cloud integration
|
35
35
|
#
|
36
36
|
# Deleting an active integration moves it to 'trash', from where
|
@@ -45,7 +45,7 @@ module Wavefront
|
|
45
45
|
api_delete(id)
|
46
46
|
end
|
47
47
|
|
48
|
-
# GET /api/v2/cloudintegration/
|
48
|
+
# GET /api/v2/cloudintegration/id
|
49
49
|
# Get a specific cloud integration
|
50
50
|
#
|
51
51
|
# @param id [String] ID of the integration
|
@@ -56,7 +56,7 @@ module Wavefront
|
|
56
56
|
api_get(id)
|
57
57
|
end
|
58
58
|
|
59
|
-
# PUT /api/v2/cloudintegration/
|
59
|
+
# PUT /api/v2/cloudintegration/id
|
60
60
|
# Update a specific cloud integration
|
61
61
|
#
|
62
62
|
# @param id [String] ID of the integration
|
@@ -68,7 +68,7 @@ module Wavefront
|
|
68
68
|
api_put(id, body)
|
69
69
|
end
|
70
70
|
|
71
|
-
# POST /api/v2/cloudintegration/
|
71
|
+
# POST /api/v2/cloudintegration/id/undelete
|
72
72
|
# Undelete a specific cloud integration
|
73
73
|
#
|
74
74
|
# @param id [String] ID of the integration
|
@@ -79,10 +79,4 @@ module Wavefront
|
|
79
79
|
api_post([id, 'undelete'].uri_concat)
|
80
80
|
end
|
81
81
|
end
|
82
|
-
|
83
|
-
# A standard response.
|
84
|
-
#
|
85
|
-
class Response
|
86
|
-
class CloudIntegration < Base; end
|
87
|
-
end
|
88
82
|
end
|
@@ -1,9 +1,19 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
require 'inifile'
|
3
|
+
require 'map'
|
3
4
|
|
4
5
|
module Wavefront
|
5
6
|
|
6
|
-
# Helper methods to get Wavefront credentials
|
7
|
+
# Helper methods to get Wavefront credentials.
|
8
|
+
#
|
9
|
+
# @return [Wavefront::Credentials]
|
10
|
+
#
|
11
|
+
# @!attribute config [r]
|
12
|
+
# @return [Map] the entire loaded config
|
13
|
+
# @!attribute creds [r]
|
14
|
+
# @return [Map] credentials for speaking to the Wavefront API
|
15
|
+
# @!attribute proxy [r]
|
16
|
+
# @return [Map] information for speaking to a Wavefront proxy
|
7
17
|
#
|
8
18
|
class Credentials
|
9
19
|
attr_reader :opts, :config, :creds, :proxy
|
@@ -35,9 +45,9 @@ module Wavefront
|
|
35
45
|
end
|
36
46
|
|
37
47
|
def populate(raw)
|
38
|
-
@config = raw
|
39
|
-
@creds = raw.select { |k, _v| [:endpoint, :token].include?(k) }
|
40
|
-
@proxy = raw.select { |k, _v| [:proxy, :port].include?(k) }
|
48
|
+
@config = Map(raw)
|
49
|
+
@creds = Map(raw.select { |k, _v| [:endpoint, :token].include?(k) })
|
50
|
+
@proxy = Map(raw.select { |k, _v| [:proxy, :port].include?(k) })
|
41
51
|
end
|
42
52
|
|
43
53
|
def load_from_file(opts)
|
@@ -4,7 +4,7 @@ module Wavefront
|
|
4
4
|
#
|
5
5
|
# View and manage dashboards.
|
6
6
|
#
|
7
|
-
class Dashboard <
|
7
|
+
class Dashboard < Base
|
8
8
|
|
9
9
|
# GET /api/v2/dashboard
|
10
10
|
# Get all dashboards for a customer.
|
@@ -29,7 +29,7 @@ module Wavefront
|
|
29
29
|
api_post('', body, 'application/json')
|
30
30
|
end
|
31
31
|
|
32
|
-
# DELETE /api/v2/dashboard/
|
32
|
+
# DELETE /api/v2/dashboard/id
|
33
33
|
# Delete a specific dashboard.
|
34
34
|
# Deleting an active dashboard moves it to 'trash', from where it can
|
35
35
|
# be restored with an #undelete operation. Deleting an dashboard in
|
@@ -43,7 +43,7 @@ module Wavefront
|
|
43
43
|
api_delete(id)
|
44
44
|
end
|
45
45
|
|
46
|
-
# GET /api/v2/dashboard/
|
46
|
+
# GET /api/v2/dashboard/id
|
47
47
|
# Get a specific dashboard / Get a specific historical version of a
|
48
48
|
# specific dashboard.
|
49
49
|
#
|
@@ -59,7 +59,7 @@ module Wavefront
|
|
59
59
|
api_get(fragments.uri_concat)
|
60
60
|
end
|
61
61
|
|
62
|
-
# PUT /api/v2/dashboard/
|
62
|
+
# PUT /api/v2/dashboard/id
|
63
63
|
# Update a specific dashboard.
|
64
64
|
#
|
65
65
|
# Refer to the Swagger API docs for valid keys.
|
@@ -73,7 +73,7 @@ module Wavefront
|
|
73
73
|
api_put(id, body)
|
74
74
|
end
|
75
75
|
|
76
|
-
# GET /api/v2/dashboard/
|
76
|
+
# GET /api/v2/dashboard/id/history
|
77
77
|
# Get the version history of an dashboard.
|
78
78
|
#
|
79
79
|
# @param id [String] ID of the dashboard
|
@@ -84,11 +84,11 @@ module Wavefront
|
|
84
84
|
api_get([id, 'history'].uri_concat)
|
85
85
|
end
|
86
86
|
|
87
|
-
# GET /api/v2/dashboard/
|
87
|
+
# GET /api/v2/dashboard/id/tag
|
88
88
|
# Get all tags associated with a specific dashboard.
|
89
89
|
#
|
90
90
|
# @param id [String] ID of the dashboard
|
91
|
-
# @
|
91
|
+
# @return [Hash] object describing the dashboard with status and
|
92
92
|
# response keys
|
93
93
|
#
|
94
94
|
def tags(id)
|
@@ -96,12 +96,12 @@ module Wavefront
|
|
96
96
|
api_get([id, 'tag'].uri_concat)
|
97
97
|
end
|
98
98
|
|
99
|
-
# POST /api/v2/dashboard/
|
99
|
+
# POST /api/v2/dashboard/id/tag
|
100
100
|
# Set all tags associated with a specific dashboard.
|
101
101
|
#
|
102
102
|
# @param id [String] ID of the dashboard
|
103
103
|
# @param tags [Array] list of tags to set.
|
104
|
-
# @
|
104
|
+
# @return [Hash] object describing the dashboard with status and
|
105
105
|
# response keys
|
106
106
|
#
|
107
107
|
def tag_set(id, tags)
|
@@ -111,12 +111,12 @@ module Wavefront
|
|
111
111
|
api_post([id, 'tag'].uri_concat, tags.to_json, 'application/json')
|
112
112
|
end
|
113
113
|
|
114
|
-
# DELETE /api/v2/dashboard/
|
114
|
+
# DELETE /api/v2/dashboard/id/tag/tagValue
|
115
115
|
# Remove a tag from a specific dashboard.
|
116
116
|
#
|
117
117
|
# @param id [String] ID of the dashboard
|
118
118
|
# @param tag [String] tag to delete
|
119
|
-
# @
|
119
|
+
# @return [Hash] object with 'status' key and empty 'repsonse'
|
120
120
|
#
|
121
121
|
def tag_delete(id, tag)
|
122
122
|
wf_dashboard_id?(id)
|
@@ -124,12 +124,12 @@ module Wavefront
|
|
124
124
|
api_delete([id, 'tag', tag].uri_concat)
|
125
125
|
end
|
126
126
|
|
127
|
-
# PUT /api/v2/dashboard/
|
127
|
+
# PUT /api/v2/dashboard/id/tag/tagValue
|
128
128
|
# Add a tag to a specific dashboard.
|
129
129
|
#
|
130
130
|
# @param id [String] ID of the dashboard
|
131
131
|
# @param tag [String] tag to set.
|
132
|
-
# @
|
132
|
+
# @return [Hash] object with 'status' key and empty 'repsonse'
|
133
133
|
#
|
134
134
|
def tag_add(id, tag)
|
135
135
|
wf_dashboard_id?(id)
|
@@ -137,7 +137,7 @@ module Wavefront
|
|
137
137
|
api_put([id, 'tag', tag].uri_concat)
|
138
138
|
end
|
139
139
|
|
140
|
-
# POST /api/v2/dashboard/
|
140
|
+
# POST /api/v2/dashboard/id/undelete
|
141
141
|
# Move an dashboard from 'trash' back into active service.
|
142
142
|
#
|
143
143
|
# @param id [String] ID of the dashboard
|
@@ -148,10 +148,4 @@ module Wavefront
|
|
148
148
|
api_post([id, 'undelete'].uri_concat)
|
149
149
|
end
|
150
150
|
end
|
151
|
-
|
152
|
-
# A standard response.
|
153
|
-
#
|
154
|
-
class Response
|
155
|
-
class Dashboard < Base; end
|
156
|
-
end
|
157
151
|
end
|