wavefront-sdk 5.3.0 → 5.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +37 -0
- data/.github/workflows/test.yml +23 -0
- data/HISTORY.md +17 -0
- data/lib/wavefront-sdk/cloudintegration.rb +4 -0
- data/lib/wavefront-sdk/core/api.rb +2 -2
- data/lib/wavefront-sdk/core/api_caller.rb +4 -3
- data/lib/wavefront-sdk/defs/version.rb +1 -1
- data/lib/wavefront-sdk/derivedmetric.rb +2 -4
- data/lib/wavefront-sdk/event.rb +4 -2
- data/lib/wavefront-sdk/ingestionpolicy.rb +4 -0
- data/lib/wavefront-sdk/notificant.rb +0 -2
- data/lib/wavefront-sdk/savedsearch.rb +4 -0
- data/lib/wavefront-sdk/support/parse_time.rb +1 -1
- data/lib/wavefront-sdk/user.rb +4 -4
- data/spec/test_mixins/general.rb +6 -0
- data/spec/wavefront-sdk/alert_spec.rb +0 -2
- data/spec/wavefront-sdk/core/api_spec.rb +9 -1
- data/spec/wavefront-sdk/dashboard_spec.rb +0 -2
- data/spec/wavefront-sdk/derivedmetric_spec.rb +1 -0
- data/spec/wavefront-sdk/notificant_spec.rb +27 -0
- metadata +5 -5
- data/spec/test_mixins/update_keys.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ece811673855c324e3a66865f9d86b9053b9a0d45ec6e911132fc00222373a6
|
4
|
+
data.tar.gz: c3db55c441feb6c6b24d3f7eb55037475a44073942799cc459be621d8f4dc471
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77b0ecdbb4457c26f8fa19729dcd0411a8413b202728094f5700c4cd1db4573c92a52b17b409e62901026096b0c6c678113fc4b6885a28149d0b972c8c7dc608
|
7
|
+
data.tar.gz: a6757a5c5a3189598a418c3a399a634ada40298a5771c16d1741785c064c5557938962efe657bca97c226884f401a0270677e7e7bbb1077ba846c3473d443fc6
|
@@ -0,0 +1,37 @@
|
|
1
|
+
name: Release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- '[0-9]+.[0-9]+.[0-9]+'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
name: Build + Publish
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- name: Set env
|
16
|
+
run: echo "RELEASE_VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV
|
17
|
+
|
18
|
+
- name: Set up Ruby 2.7
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: 2.7
|
22
|
+
- run: bundle install
|
23
|
+
|
24
|
+
- name: Run tests
|
25
|
+
run: bundle exec rake
|
26
|
+
|
27
|
+
- name: Build Gem
|
28
|
+
run: bundle exec rake build
|
29
|
+
|
30
|
+
- name: Publish to RubyGems
|
31
|
+
run: |
|
32
|
+
mkdir -p ${HOME}/.gem
|
33
|
+
echo -e "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}" >${HOME}/.gem/credentials
|
34
|
+
chmod 0600 ${HOME}/.gem/credentials
|
35
|
+
gem push pkg/*.gem
|
36
|
+
env:
|
37
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches-ignore: release
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
ruby-version: [2.5.8, 2.6.6, 2.7.2]
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- name: Set up Ruby
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby-version }}
|
19
|
+
bundler-cache: true
|
20
|
+
- name: Install dependencies
|
21
|
+
run: bundle install
|
22
|
+
- name: Run tests
|
23
|
+
run: bundle exec rake
|
data/HISTORY.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 5.4.3 (2021-01-28)
|
4
|
+
* Always pass through invalid timestamp on time-parsing error.
|
5
|
+
|
6
|
+
## 5.4.2 (2021-01-11)
|
7
|
+
* Fix bug which blocked event updates.
|
8
|
+
|
9
|
+
## 5.4.1 (2020-12-17)
|
10
|
+
* Fix error on derived metric modification.
|
11
|
+
|
12
|
+
## 5.4.0 (2020-12-16)
|
13
|
+
* Add `raw_response` option, which makes the SDK return the raw API response
|
14
|
+
as plain JSON text, rather than as a `Wavefront::Response` object.
|
15
|
+
|
16
|
+
## 5.3.1 (2020-12-11)
|
17
|
+
* Fix error when renaming ingestion policies, and improve testing which should
|
18
|
+
have caught the problem in the first place.
|
19
|
+
|
3
20
|
## 5.3.0 (2020-10-10)
|
4
21
|
* Add `Wavefront::Proxy#shutdown` which can shut down a proxy via the API.
|
5
22
|
|
@@ -81,9 +81,9 @@ module Wavefront
|
|
81
81
|
(time.to_f * 1000).round
|
82
82
|
end
|
83
83
|
|
84
|
-
#
|
84
|
+
# Doing a PUT to update an object requires only a certain subset of
|
85
85
|
# the keys returned by #describe(). This method takes the
|
86
|
-
# existing description of an object and turns it into a new
|
86
|
+
# existing description of an object and turns it into a new hash
|
87
87
|
# which can be PUT.
|
88
88
|
#
|
89
89
|
# @param old [Hash] a hash of the existing object
|
@@ -15,8 +15,7 @@ module Wavefront
|
|
15
15
|
class ApiCaller
|
16
16
|
include Wavefront::Mixins
|
17
17
|
|
18
|
-
attr_reader :opts, :noop, :debug, :verbose, :net, :logger,
|
19
|
-
:calling_class
|
18
|
+
attr_reader :opts, :noop, :debug, :verbose, :net, :logger, :calling_class
|
20
19
|
|
21
20
|
# @param calling_class [
|
22
21
|
# @param creds [Hash] Wavefront credentials
|
@@ -178,7 +177,9 @@ module Wavefront
|
|
178
177
|
resp.body
|
179
178
|
end
|
180
179
|
|
181
|
-
|
180
|
+
return body if opts[:raw_response]
|
181
|
+
|
182
|
+
Wavefront::Response.new(body, resp.status, opts)
|
182
183
|
end
|
183
184
|
|
184
185
|
# Try to describe the actual HTTP calls we make. There's a bit
|
@@ -112,11 +112,9 @@ module Wavefront
|
|
112
112
|
wf_derivedmetric_id?(id)
|
113
113
|
end
|
114
114
|
|
115
|
-
private
|
116
|
-
|
117
115
|
def update_keys
|
118
|
-
%i[id name query tags additionalInformation
|
119
|
-
|
116
|
+
%i[id name query tags additionalInformation includeObsoleteMetrics
|
117
|
+
processRateMinutes minutes]
|
120
118
|
end
|
121
119
|
end
|
122
120
|
end
|
data/lib/wavefront-sdk/event.rb
CHANGED
@@ -12,7 +12,7 @@ module Wavefront
|
|
12
12
|
include Wavefront::Mixin::Tag
|
13
13
|
|
14
14
|
def update_keys
|
15
|
-
%i[
|
15
|
+
%i[id name]
|
16
16
|
end
|
17
17
|
|
18
18
|
# GET /api/v2/event
|
@@ -100,7 +100,9 @@ module Wavefront
|
|
100
100
|
|
101
101
|
return api.put(id, body, 'application/json') unless modify
|
102
102
|
|
103
|
-
api.put(id,
|
103
|
+
api.put(id,
|
104
|
+
hash_for_update(describe(id).response, body),
|
105
|
+
'application/json')
|
104
106
|
end
|
105
107
|
|
106
108
|
# POST /api/v2/event/id/close
|
data/lib/wavefront-sdk/user.rb
CHANGED
@@ -297,6 +297,10 @@ module Wavefront
|
|
297
297
|
raise NoMethodError
|
298
298
|
end
|
299
299
|
|
300
|
+
def update_keys
|
301
|
+
%i[identifier groups userGroups]
|
302
|
+
end
|
303
|
+
|
300
304
|
private
|
301
305
|
|
302
306
|
def response_looks_right?(body_obj)
|
@@ -311,9 +315,5 @@ module Wavefront
|
|
311
315
|
|
312
316
|
items.fetch(:message, 'no message from API')
|
313
317
|
end
|
314
|
-
|
315
|
-
def update_keys
|
316
|
-
%i[identifier groups userGroups]
|
317
|
-
end
|
318
318
|
end
|
319
319
|
end
|
data/spec/test_mixins/general.rb
CHANGED
@@ -65,6 +65,7 @@ module WavefrontTest
|
|
65
65
|
module Update
|
66
66
|
def test_update
|
67
67
|
[payload].flatten.each do |p|
|
68
|
+
# passes payload through as-is
|
68
69
|
assert_puts("/api/v2/#{api_class}/#{id}", p) do
|
69
70
|
wf.update(id, p, false)
|
70
71
|
end
|
@@ -73,6 +74,11 @@ module WavefrontTest
|
|
73
74
|
assert_raises(ArgumentError) { wf.update }
|
74
75
|
end
|
75
76
|
end
|
77
|
+
|
78
|
+
def test_update_keys
|
79
|
+
assert_instance_of Array, wf.update_keys
|
80
|
+
assert(wf.update_keys.all? { |k| k.is_a?(Symbol) })
|
81
|
+
end
|
76
82
|
end
|
77
83
|
|
78
84
|
module Clone
|
@@ -4,7 +4,6 @@
|
|
4
4
|
require_relative '../spec_helper'
|
5
5
|
require_relative '../test_mixins/acl'
|
6
6
|
require_relative '../test_mixins/tag'
|
7
|
-
require_relative '../test_mixins/update_keys'
|
8
7
|
require_relative '../test_mixins/general'
|
9
8
|
|
10
9
|
# Unit tests for Alert class
|
@@ -20,7 +19,6 @@ class WavefrontAlertTest < WavefrontTestBase
|
|
20
19
|
include WavefrontTest::List
|
21
20
|
include WavefrontTest::Tag
|
22
21
|
include WavefrontTest::Update
|
23
|
-
include WavefrontTest::UpdateKeys
|
24
22
|
|
25
23
|
def test_snooze
|
26
24
|
assert_posts("/api/v2/alert/#{id}/snooze") { wf.snooze(id) }
|
@@ -23,7 +23,15 @@ class WavefrontCoreApiTest < MiniTest::Test
|
|
23
23
|
|
24
24
|
def test_hash_for_update
|
25
25
|
wf.instance_variable_set('@update_keys', %i[k1 k2])
|
26
|
-
body = { k1: 'ov1',
|
26
|
+
body = { k1: 'ov1',
|
27
|
+
k2: 'ov2',
|
28
|
+
k3: 'ov3',
|
29
|
+
customerId: 'test',
|
30
|
+
creatorId: 'someone@example.com',
|
31
|
+
createUserId: 'someone@example.com',
|
32
|
+
updateUserId: 'someone@example.com',
|
33
|
+
createdEpochMillis: 1_607_691_387_023,
|
34
|
+
updatedEpochMillis: 1_607_691_387_023 }
|
27
35
|
upd = { k2: 'nv1' }
|
28
36
|
assert_equal({ k1: 'ov1', k2: 'nv1' }, wf.hash_for_update(body, upd))
|
29
37
|
end
|
@@ -4,7 +4,6 @@
|
|
4
4
|
require_relative '../spec_helper'
|
5
5
|
require_relative '../test_mixins/acl'
|
6
6
|
require_relative '../test_mixins/tag'
|
7
|
-
require_relative '../test_mixins/update_keys'
|
8
7
|
require_relative '../test_mixins/general'
|
9
8
|
|
10
9
|
# Unit tests for dashboard class
|
@@ -18,7 +17,6 @@ class WavefrontDashboardTest < WavefrontTestBase
|
|
18
17
|
include WavefrontTest::List
|
19
18
|
include WavefrontTest::Tag
|
20
19
|
include WavefrontTest::Update
|
21
|
-
include WavefrontTest::UpdateKeys
|
22
20
|
|
23
21
|
def test_favorite
|
24
22
|
assert_posts("/api/v2/dashboard/#{id}/favorite") { wf.favorite(id) }
|
@@ -10,6 +10,7 @@ class WavefrontNotificantTest < WavefrontTestBase
|
|
10
10
|
include WavefrontTest::List
|
11
11
|
include WavefrontTest::Delete
|
12
12
|
include WavefrontTest::Describe
|
13
|
+
include WavefrontTest::Update
|
13
14
|
|
14
15
|
def test_test
|
15
16
|
assert_posts("/api/v2/notificant/test/#{id}") { wf.test(id) }
|
@@ -29,4 +30,30 @@ class WavefrontNotificantTest < WavefrontTestBase
|
|
29
30
|
def invalid_id
|
30
31
|
'---rubbish---'
|
31
32
|
end
|
33
|
+
|
34
|
+
def payload
|
35
|
+
JSON.parse(%(
|
36
|
+
{
|
37
|
+
"method": "PAGERDUTY",
|
38
|
+
"id": "PE0BEkf4r123yooO",
|
39
|
+
"contentType": "",
|
40
|
+
"description": "Test target",
|
41
|
+
"customerId": "sysdef",
|
42
|
+
"title": "Terraform Test Target",
|
43
|
+
"recipient": "12345678910111213141516171819202",
|
44
|
+
"creatorId": "someone@example.com",
|
45
|
+
"updaterId": "someone@example.com",
|
46
|
+
"createdEpochMillis": 1604513812010,
|
47
|
+
"updatedEpochMillis": 1604513812010,
|
48
|
+
"template": "{}",
|
49
|
+
"triggers": [
|
50
|
+
"ALERT_OPENED",
|
51
|
+
"ALERT_RESOLVED"
|
52
|
+
],
|
53
|
+
"customHttpHeaders": {},
|
54
|
+
"emailSubject": "",
|
55
|
+
"isHtmlContent": false
|
56
|
+
}
|
57
|
+
), symbolize_names: true)
|
58
|
+
end
|
32
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wavefront-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.3
|
4
|
+
version: 5.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Fisher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -171,6 +171,8 @@ extensions: []
|
|
171
171
|
extra_rdoc_files: []
|
172
172
|
files:
|
173
173
|
- ".codeclimate.yml"
|
174
|
+
- ".github/workflows/release.yml"
|
175
|
+
- ".github/workflows/test.yml"
|
174
176
|
- ".gitignore"
|
175
177
|
- ".rubocop.yml"
|
176
178
|
- ".travis.yml"
|
@@ -254,7 +256,6 @@ files:
|
|
254
256
|
- spec/test_mixins/acl.rb
|
255
257
|
- spec/test_mixins/general.rb
|
256
258
|
- spec/test_mixins/tag.rb
|
257
|
-
- spec/test_mixins/update_keys.rb
|
258
259
|
- spec/wavefront-sdk/account_spec.rb
|
259
260
|
- spec/wavefront-sdk/alert_spec.rb
|
260
261
|
- spec/wavefront-sdk/api_mixins/user_mixins_spec.rb
|
@@ -337,7 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
337
338
|
- !ruby/object:Gem::Version
|
338
339
|
version: '0'
|
339
340
|
requirements: []
|
340
|
-
rubygems_version: 3.
|
341
|
+
rubygems_version: 3.1.4
|
341
342
|
signing_key:
|
342
343
|
specification_version: 4
|
343
344
|
summary: SDK for Wavefront API v2
|
@@ -352,7 +353,6 @@ test_files:
|
|
352
353
|
- spec/test_mixins/acl.rb
|
353
354
|
- spec/test_mixins/general.rb
|
354
355
|
- spec/test_mixins/tag.rb
|
355
|
-
- spec/test_mixins/update_keys.rb
|
356
356
|
- spec/wavefront-sdk/account_spec.rb
|
357
357
|
- spec/wavefront-sdk/alert_spec.rb
|
358
358
|
- spec/wavefront-sdk/api_mixins/user_mixins_spec.rb
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module WavefrontTest
|
4
|
-
#
|
5
|
-
# include this into any class which has update keys
|
6
|
-
#
|
7
|
-
module UpdateKeys
|
8
|
-
def test_update_keys
|
9
|
-
assert_instance_of Array, wf.update_keys
|
10
|
-
assert(wf.update_keys.all? { |k| k.is_a?(Symbol) })
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|