wavefront-sdk 3.3.4 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69e5b7ef712204907db606287f0d84d3c89a2784e9d8edbc53415b2277311081
4
- data.tar.gz: e1f7e4c28c8c1d42194cff7c5ce6a5ec55b25dd838883159fba2b8e2a0faa6ee
3
+ metadata.gz: bf113855e97fd18cd468edb2eb47cc94ff7551ffdfd4eae01d151f3dd83f843d
4
+ data.tar.gz: 2af7243524750797cb4da86732a0e39a0b7d050052a8b540ce732aa22a2ce516
5
5
  SHA512:
6
- metadata.gz: 9c55603c0db5ad279802221f3f7eb945e04f861743fb9599c4bbd97e03d51ca6902956ac9aa35202ef1271a6a0d13ee9d96d8cd26b0f89eb81192d2b65772b33
7
- data.tar.gz: 2e922eb985d685075076ad3da8100296ae891fb645f00211b8ddb4a03b05f16708ed3f8a5a45761277cebec2394a3bc00cbf63b76b70291e94e456f10cb442cb
6
+ metadata.gz: 8690b71bfe78192af6360fcebea3c95e19901d4f8f673d8fb557533d91982c2f394b9f4462e3e2827eb2d7171e25b9a11885d080e44c85ea6aeb0d66dceb01ea
7
+ data.tar.gz: 6ef9ab034e8f48df21a54aa122b1f6b6a3dbc03e716dcd91e4e1b752b918f71bb693912041aeadad0837692cb0fffd955d71e70ba9dca5f84390ce0c9e264ff2
data/.travis.yml CHANGED
@@ -2,9 +2,9 @@ language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
4
  - 2.3.8
5
- - 2.4.5
6
- - 2.5.5
7
- - 2.6.2
5
+ - 2.4.7
6
+ - 2.5.6
7
+ - 2.6.4
8
8
  before_install: gem install bundler --no-document
9
9
  deploy:
10
10
  provider: rubygems
@@ -14,7 +14,7 @@ deploy:
14
14
  on:
15
15
  tags: true
16
16
  repo: snltd/wavefront-sdk
17
- ruby: 2.6.2
17
+ ruby: 2.6.4
18
18
  notifications:
19
19
  email: false
20
20
  slack:
data/HISTORY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.4.0 (2019-09-28)
4
+ * Add `serviceaccount` class.
5
+ * Validator exceptions now return the value which failed validation.
6
+
3
7
  ## 3.3.4 (2019-09-18)
4
8
  * Upgrade Rubocop dev dependency to 0.74.0, and make codebase compliant with
5
9
  those standards. No interfaces are changed.
@@ -31,12 +31,14 @@ module Wavefront
31
31
  class InvalidMetricValue < RuntimeError; end
32
32
  class InvalidName < RuntimeError; end
33
33
  class InvalidNotificantId < RuntimeError; end
34
+ class InvalidPermission < RuntimeError; end
34
35
  class InvalidPoint < RuntimeError; end
35
36
  class InvalidPrefixLength < RuntimeError; end
36
37
  class InvalidProxyId < RuntimeError; end
37
38
  class InvalidRelativeTime < RuntimeError; end
38
39
  class InvalidSavedSearchEntity < RuntimeError; end
39
40
  class InvalidSavedSearchId < RuntimeError; end
41
+ class InvalidServiceAccountId < RuntimeError; end
40
42
  class InvalidSourceId < RuntimeError; end
41
43
  class InvalidString < RuntimeError; end
42
44
  class InvalidTag < RuntimeError; end
@@ -2,5 +2,5 @@
2
2
 
3
3
  require 'pathname'
4
4
 
5
- WF_SDK_VERSION = '3.3.4'
5
+ WF_SDK_VERSION = '3.4.0'
6
6
  WF_SDK_LOCATION = Pathname.new(__dir__).parent.parent.parent
@@ -74,7 +74,7 @@ module Wavefront
74
74
  # a hash describing the existing object, and modify that with
75
75
  # the new body. If false, pass the new body straight through.
76
76
  # @return [Wavefront::Response]
77
-
77
+ #
78
78
  def update(id, body, modify = true)
79
79
  wf_derivedmetric_id?(id)
80
80
  raise ArgumentError unless body.is_a?(Hash)
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'core/api'
4
+
5
+ module Wavefront
6
+ #
7
+ # Manage and query Wavefront service accounts
8
+ #
9
+ class ServiceAccount < CoreApi
10
+ def api_base
11
+ '/account/serviceaccount'
12
+ end
13
+
14
+ # GET /api/v2/account/serviceaccount
15
+ # Get all service accounts
16
+ #
17
+ # @param offset [Integer] webhook at which the list begins
18
+ # @param limit [Integer] the number of webhooks to return
19
+ #
20
+ def list
21
+ api.get('')
22
+ end
23
+
24
+ # POST /api/v2/account/serviceaccount
25
+ # Creates a service account
26
+ # Refer to the Swagger API docs for valid keys.
27
+ #
28
+ # @param body [Hash] description of service account
29
+ # @return [Wavefront::Response]
30
+ #
31
+ def create(body)
32
+ raise ArgumentError unless body.is_a?(Hash)
33
+
34
+ api.post('', body, 'application/json')
35
+ end
36
+
37
+ # GET /api/v2/account/serviceaccount/{id}
38
+ # Retrieves a service account by identifier
39
+ #
40
+ # @param id [String, Integer] ID of the account
41
+ # @return [Wavefront::Response]
42
+ #
43
+ def describe(id)
44
+ wf_serviceaccount_id?(id)
45
+ api.get(id)
46
+ end
47
+
48
+ # PUT /api/v2/account/serviceaccount/{id}
49
+ # Updates the service account
50
+ #
51
+ # @param id [String] a Wavefront service account ID
52
+ # @param body [Hash] key-value hash of the parameters you wish
53
+ # to change
54
+ # @param modify [true, false] if true, use {#describe()} to get
55
+ # a hash describing the existing object, and modify that with
56
+ # the new body. If false, pass the new body straight through.
57
+ # @return [Wavefront::Response]
58
+ #
59
+ def update(id, body, modify = true)
60
+ wf_serviceaccount_id?(id)
61
+ raise ArgumentError unless body.is_a?(Hash)
62
+
63
+ return api.put(id, body, 'application/json') unless modify
64
+
65
+ api.put(id, hash_for_update(describe(id).response, body),
66
+ 'application/json')
67
+ end
68
+
69
+ # POST /api/v2/account/serviceaccount/{id}/activate
70
+ # Activates the given service account
71
+ #
72
+ # @param id [String, Integer] ID of the account
73
+ # @return [Wavefront::Response]
74
+ #
75
+ def activate(id)
76
+ wf_serviceaccount_id?(id)
77
+ api.post([id, 'activate'].uri_concat, nil, 'application/json')
78
+ end
79
+
80
+ # POST /api/v2/account/serviceaccount/{id}/deactivate
81
+ # Deactivates the given service account
82
+ #
83
+ # @param id [String, Integer] ID of the account
84
+ # @return [Wavefront::Response]
85
+ #
86
+ def deactivate(id)
87
+ wf_serviceaccount_id?(id)
88
+ api.post([id, 'deactivate'].uri_concat, nil, 'application/json')
89
+ end
90
+
91
+ def update_keys
92
+ %i[description tokens groups userGroups active identifier]
93
+ end
94
+ end
95
+ end
@@ -35,7 +35,7 @@ module Wavefront
35
35
  return true
36
36
  end
37
37
 
38
- raise Wavefront::Exception::InvalidLinkTemplate
38
+ raise Wavefront::Exception::InvalidLinkTemplate, template
39
39
  end
40
40
 
41
41
  # Ensure the given argument is a valid Wavefront metric name, or
@@ -53,7 +53,7 @@ module Wavefront
53
53
  return true
54
54
  end
55
55
 
56
- raise Wavefront::Exception::InvalidMetricName
56
+ raise Wavefront::Exception::InvalidMetricName, metric
57
57
  end
58
58
 
59
59
  # Ensure the given argument is a valid name, for instance for an
@@ -66,7 +66,7 @@ module Wavefront
66
66
  def wf_name?(name)
67
67
  return true if name.is_a?(String) && name.size < 1024 && name =~ /^\w+$/
68
68
 
69
- raise Wavefront::Exception::InvalidName
69
+ raise Wavefront::Exception::InvalidName, name
70
70
  end
71
71
 
72
72
  # Ensure the given argument is a valid string, for a tag name.
@@ -85,7 +85,7 @@ module Wavefront
85
85
  return true
86
86
  end
87
87
 
88
- raise Wavefront::Exception::InvalidString
88
+ raise Wavefront::Exception::InvalidString, str
89
89
  end
90
90
 
91
91
  # Ensure the given argument is a valid timestamp
@@ -97,7 +97,7 @@ module Wavefront
97
97
  def wf_ts?(timestamp)
98
98
  return true if timestamp.is_a?(Time) || timestamp.is_a?(Date)
99
99
 
100
- raise Wavefront::Exception::InvalidTimestamp
100
+ raise Wavefront::Exception::InvalidTimestamp, timestamp
101
101
  end
102
102
 
103
103
  # Ensure the given argument is a valid millisecond epoch
@@ -112,7 +112,7 @@ module Wavefront
112
112
  def wf_ms_ts?(timestamp)
113
113
  return true if timestamp.is_a?(Numeric)
114
114
 
115
- raise Wavefront::Exception::InvalidTimestamp
115
+ raise Wavefront::Exception::InvalidTimestamp, timestamp
116
116
  end
117
117
 
118
118
  # Ensure the given argument is a valid epoch timestamp. Again,
@@ -125,7 +125,7 @@ module Wavefront
125
125
  def wf_epoch?(timestamp)
126
126
  return true if timestamp.is_a?(Numeric)
127
127
 
128
- raise Wavefront::Exception::InvalidTimestamp
128
+ raise Wavefront::Exception::InvalidTimestamp, timestamp
129
129
  end
130
130
 
131
131
  # Ensure one, or an array, of tags are valid. These tags are
@@ -140,7 +140,7 @@ module Wavefront
140
140
  def wf_tag?(*tags)
141
141
  Array(*tags).each do |tag|
142
142
  unless tag.is_a?(String) && tag.size < 255 && tag =~ /^[\w:\-\.]+$/
143
- raise Wavefront::Exception::InvalidTag
143
+ raise Wavefront::Exception::InvalidTag, tag
144
144
  end
145
145
  end
146
146
 
@@ -157,7 +157,7 @@ module Wavefront
157
157
  def wf_value?(value)
158
158
  return true if value.is_a?(Numeric)
159
159
 
160
- raise Wavefront::Exception::InvalidMetricValue
160
+ raise Wavefront::Exception::InvalidMetricValue, value
161
161
  end
162
162
 
163
163
  # Ensure the given argument is a valid version number
@@ -171,7 +171,7 @@ module Wavefront
171
171
  version = version.to_i if version.is_a?(String) && version =~ /^\d+$/
172
172
  return true if version.is_a?(Integer) && version.positive?
173
173
 
174
- raise Wavefront::Exception::InvalidVersion
174
+ raise Wavefront::Exception::InvalidVersion, version
175
175
  end
176
176
 
177
177
  # Ensure a hash of key:value point tags are value. Not to be
@@ -200,7 +200,7 @@ module Wavefront
200
200
  return
201
201
  end
202
202
 
203
- raise Wavefront::Exception::InvalidTag
203
+ raise Wavefront::Exception::InvalidTag, "#{key}=#{val}"
204
204
  end
205
205
 
206
206
  # Ensure the given argument is a valid Wavefront proxy ID
@@ -213,7 +213,7 @@ module Wavefront
213
213
  def wf_proxy_id?(id)
214
214
  return true if uuid?(id)
215
215
 
216
- raise Wavefront::Exception::InvalidProxyId
216
+ raise Wavefront::Exception::InvalidProxyId, id
217
217
  end
218
218
 
219
219
  # Ensure the given argument is a valid Wavefront alert ID.
@@ -229,7 +229,7 @@ module Wavefront
229
229
  id = id.to_s if id.is_a?(Numeric)
230
230
  return true if id.is_a?(String) && id.match(/^\d{13}$/)
231
231
 
232
- raise Wavefront::Exception::InvalidAlertId
232
+ raise Wavefront::Exception::InvalidAlertId, id
233
233
  end
234
234
 
235
235
  # Ensure the given argument is a valid Wavefront cloud
@@ -243,7 +243,7 @@ module Wavefront
243
243
  def wf_cloudintegration_id?(id)
244
244
  return true if uuid?(id)
245
245
 
246
- raise Wavefront::Exception::InvalidCloudIntegrationId
246
+ raise Wavefront::Exception::InvalidCloudIntegrationId, id
247
247
  end
248
248
 
249
249
  # There doesn't seem to be a public statement on what's allowed
@@ -258,7 +258,7 @@ module Wavefront
258
258
  def wf_dashboard_id?(id)
259
259
  return true if id.is_a?(String) && id.size < 256 && id.match(/^[\w\-]+$/)
260
260
 
261
- raise Wavefront::Exception::InvalidDashboardId
261
+ raise Wavefront::Exception::InvalidDashboardId, id
262
262
  end
263
263
 
264
264
  # Ensure the given argument is a valid derived metric ID. IDs
@@ -273,7 +273,7 @@ module Wavefront
273
273
  id = id.to_s if id.is_a?(Numeric)
274
274
  return true if id.is_a?(String) && id =~ /^\d{13}$/
275
275
 
276
- raise Wavefront::Exception::InvalidDerivedMetricId
276
+ raise Wavefront::Exception::InvalidDerivedMetricId, id
277
277
  end
278
278
 
279
279
  # Ensure the given argument is a valid event ID. Event IDs are
@@ -288,7 +288,7 @@ module Wavefront
288
288
  def wf_event_id?(id)
289
289
  return true if id.is_a?(String) && id =~ /^\d{13}:.+/
290
290
 
291
- raise Wavefront::Exception::InvalidEventId
291
+ raise Wavefront::Exception::InvalidEventId, id
292
292
  end
293
293
 
294
294
  # Ensure the given argument is a valid external Link ID
@@ -301,7 +301,7 @@ module Wavefront
301
301
  def wf_link_id?(id)
302
302
  return true if id.is_a?(String) && id =~ /^\w{16}$/
303
303
 
304
- raise Wavefront::Exception::InvalidExternalLinkId
304
+ raise Wavefront::Exception::InvalidExternalLinkId, id
305
305
  end
306
306
 
307
307
  # Ensure the given argument is a valid maintenance window ID.
@@ -316,7 +316,7 @@ module Wavefront
316
316
  id = id.to_s if id.is_a?(Numeric)
317
317
  return true if id.is_a?(String) && id =~ /^\d{13}$/
318
318
 
319
- raise Wavefront::Exception::InvalidMaintenanceWindowId
319
+ raise Wavefront::Exception::InvalidMaintenanceWindowId, id
320
320
  end
321
321
 
322
322
  # Ensure the given argument is a valid alert severity
@@ -328,7 +328,7 @@ module Wavefront
328
328
  def wf_alert_severity?(severity)
329
329
  return true if %w[INFO SMOKE WARN SEVERE].include?(severity)
330
330
 
331
- raise Wavefront::Exception::InvalidAlertSeverity
331
+ raise Wavefront::Exception::InvalidAlertSeverity, severity
332
332
  end
333
333
 
334
334
  # Ensure the given argument is a valid message ID
@@ -340,7 +340,7 @@ module Wavefront
340
340
  def wf_message_id?(id)
341
341
  return true if id.is_a?(String) && id =~ /^\w+::\w+$/
342
342
 
343
- raise Wavefront::Exception::InvalidMessageId
343
+ raise Wavefront::Exception::InvalidMessageId, id
344
344
  end
345
345
 
346
346
  # Ensure the given argument is a valid query granularity
@@ -353,7 +353,7 @@ module Wavefront
353
353
  def wf_granularity?(granularity)
354
354
  return true if %w[d h m s].include?(granularity.to_s)
355
355
 
356
- raise Wavefront::Exception::InvalidGranularity
356
+ raise Wavefront::Exception::InvalidGranularity, granularity
357
357
  end
358
358
 
359
359
  # Ensure the given argument is a valid saved search ID.
@@ -365,7 +365,7 @@ module Wavefront
365
365
  def wf_savedsearch_id?(id)
366
366
  return true if id.is_a?(String) && id =~ /^\w{8}$/
367
367
 
368
- raise Wavefront::Exception::InvalidSavedSearchId
368
+ raise Wavefront::Exception::InvalidSavedSearchId, id
369
369
  end
370
370
 
371
371
  # Ensure the given argument is a valid saved search entity type.
@@ -380,7 +380,7 @@ module Wavefront
380
380
  NOTIFICANT EVENT SOURCE EXTERNAL_LINK AGENT
381
381
  CLOUD_INTEGRATION].include?(id)
382
382
 
383
- raise Wavefront::Exception::InvalidSavedSearchEntity
383
+ raise Wavefront::Exception::InvalidSavedSearchEntity, id
384
384
  end
385
385
 
386
386
  # Ensure the given argument is a valid Wavefront source name
@@ -396,7 +396,7 @@ module Wavefront
396
396
  return true
397
397
  end
398
398
 
399
- raise Wavefront::Exception::InvalidSourceId
399
+ raise Wavefront::Exception::InvalidSourceId, source
400
400
  end
401
401
 
402
402
  # Ensure the given argument is a valid user.
@@ -408,7 +408,7 @@ module Wavefront
408
408
  def wf_user_id?(user)
409
409
  return true if user.is_a?(String) && user.length < 256 && !user.empty?
410
410
 
411
- raise Wavefront::Exception::InvalidUserId
411
+ raise Wavefront::Exception::InvalidUserId, user
412
412
  end
413
413
 
414
414
  # Ensure the given argument is a valid user group.
@@ -420,7 +420,7 @@ module Wavefront
420
420
  def wf_usergroup_id?(gid)
421
421
  return true if uuid?(gid)
422
422
 
423
- raise Wavefront::Exception::InvalidUserGroupId
423
+ raise Wavefront::Exception::InvalidUserGroupId, gid
424
424
  end
425
425
 
426
426
  # Ensure the given argument is a valid webhook ID.
@@ -432,7 +432,7 @@ module Wavefront
432
432
  def wf_webhook_id?(id)
433
433
  return true if id.is_a?(String) && id =~ /^[a-zA-Z0-9]{16}$/
434
434
 
435
- raise Wavefront::Exception::InvalidWebhookId
435
+ raise Wavefront::Exception::InvalidWebhookId, id
436
436
  end
437
437
 
438
438
  # Validate a point so it conforms to the standard described in
@@ -491,7 +491,7 @@ module Wavefront
491
491
  def wf_notificant_id?(id)
492
492
  return true if id.is_a?(String) && id =~ /^\w{16}$/
493
493
 
494
- raise Wavefront::Exception::InvalidNotificantId
494
+ raise Wavefront::Exception::InvalidNotificantId, id
495
495
  end
496
496
 
497
497
  # Ensure the given argument is a valid Wavefront
@@ -505,7 +505,7 @@ module Wavefront
505
505
  def wf_integration_id?(id)
506
506
  return true if id.is_a?(String) && id =~ /^[a-z0-9]+$/
507
507
 
508
- raise Wavefront::Exception::InvalidIntegrationId
508
+ raise Wavefront::Exception::InvalidIntegrationId, id
509
509
  end
510
510
 
511
511
  # Ensure the given argument is a valid distribution interval.
@@ -516,7 +516,7 @@ module Wavefront
516
516
  def wf_distribution_interval?(interval)
517
517
  return true if %i[m h d].include?(interval)
518
518
 
519
- raise Wavefront::Exception::InvalidDistributionInterval
519
+ raise Wavefront::Exception::InvalidDistributionInterval, interval
520
520
  end
521
521
 
522
522
  # Ensure the given argument is a valid distribution count.
@@ -527,18 +527,46 @@ module Wavefront
527
527
  def wf_distribution_count?(count)
528
528
  return true if count.is_a?(Integer) && count.positive?
529
529
 
530
- raise Wavefront::Exception::InvalidDistributionCount
530
+ raise Wavefront::Exception::InvalidDistributionCount, count
531
531
  end
532
532
 
533
533
  # Ensure the given argument is a valid API token ID
534
534
  # @param id [String]
535
535
  # @raise Wavefront::Exception::InvalidApiTokenId if the
536
- # count is not valid
536
+ # token ID is not valid
537
537
  #
538
538
  def wf_apitoken_id?(id)
539
539
  return true if uuid?(id)
540
540
 
541
- raise Wavefront::Exception::InvalidApiTokenId
541
+ raise Wavefront::Exception::InvalidApiTokenId, id
542
+ end
543
+
544
+ # Ensure the given argument is a valid service account ID
545
+ # @param id [String]
546
+ # @raise Wavefront::Exception::InvalidApiTokenId if the
547
+ # ID is not valid
548
+ #
549
+ def wf_serviceaccount_id?(id)
550
+ return true if id.is_a?(String) && id.start_with?('sa::')
551
+
552
+ raise Wavefront::Exception::InvalidServiceAccountId, id
553
+ end
554
+
555
+ # Ensure the given argument is a Wavefront permission
556
+ # @param id [String]
557
+ # @raise Wavefront::Exception::InvalidApiTokenId if the
558
+ # ID is not valid
559
+ #
560
+ def wf_permission?(id)
561
+ if %w[alerts_management batch_query_priority embedded_charts
562
+ dashboard_management derived_metrics_management ingestion
563
+ events_management external_links_management
564
+ application_management metrics_management agent_management
565
+ host_tag_management user_management].include?(id)
566
+ return true
567
+ end
568
+
569
+ raise Wavefront::Exception::InvalidPermission, id, id
542
570
  end
543
571
  end
544
572
  # rubocop:enable Metrics/ModuleLength
data/spec/.rubocop.yml CHANGED
@@ -5,7 +5,7 @@ Metrics/AbcSize:
5
5
  # Offense count: 5
6
6
  # Configuration parameters: CountComments.
7
7
  Metrics/ClassLength:
8
- Max: 279
8
+ Max: 300
9
9
 
10
10
  # Offense count: 46
11
11
  # Configuration parameters: CountComments, ExcludedMethods.
@@ -85,12 +85,12 @@ module Minitest
85
85
  end
86
86
 
87
87
  def extra_headers(payload, type)
88
- if payload.nil?
88
+ if type
89
+ header_lookup(type)
90
+ elsif payload.nil?
89
91
  header_lookup(:plain)
90
92
  elsif type.nil?
91
93
  header_lookup(:json)
92
- else
93
- header_lookup(type)
94
94
  end
95
95
  end
96
96
 
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../spec_helper'
5
+ require_relative '../test_mixins/general'
6
+
7
+ # Unit tests for ServiceAccount class
8
+ #
9
+ class WavefrontServiceAccountTest < WavefrontTestBase
10
+ # include WavefrontTest::Create
11
+ # include WavefrontTest::Describe
12
+ # include WavefrontTest::Update
13
+
14
+ # def test_list
15
+ # assert_gets('/api/v2/account/serviceaccount') { wf.list }
16
+ # end
17
+
18
+ def test_activate
19
+ assert_posts("/api/v2/account/serviceaccount/#{id}/activate", nil,
20
+ :json) do
21
+ wf.activate(id)
22
+ end
23
+
24
+ assert_invalid_id { wf.activate(invalid_id) }
25
+ assert_raises(ArgumentError) { wf.activate }
26
+ end
27
+
28
+ def test_deactivate
29
+ assert_posts("/api/v2/account/serviceaccount/#{id}/deactivate", nil,
30
+ :json) do
31
+ wf.deactivate(id)
32
+ end
33
+
34
+ assert_invalid_id { wf.deactivate(invalid_id) }
35
+ assert_raises(ArgumentError) { wf.deactivate }
36
+ end
37
+
38
+ private
39
+
40
+ def api_class
41
+ 'account/serviceaccount'
42
+ end
43
+
44
+ def id
45
+ 'sa::tester'
46
+ end
47
+
48
+ def invalid_id
49
+ 'bad_id'
50
+ end
51
+
52
+ def payload
53
+ { identifier: id,
54
+ description: 'some info',
55
+ tokens: [
56
+ 'f8dc0c14-91a0-4ca9-8a2a-7d47f4db4672'
57
+ ],
58
+ userGroups: [
59
+ '2659191e-aad4-4302-a94e-9667e1517127'
60
+ ],
61
+ groups: [
62
+ 'agent_management'
63
+ ] }
64
+ end
65
+ end
@@ -351,4 +351,18 @@ class WavefrontValidatorsTest < MiniTest::Test
351
351
  good_and_bad('wf_distribution_interval?',
352
352
  'InvalidDistributionInterval', good, bad)
353
353
  end
354
+
355
+ def test_serviceaccount_id
356
+ good = %w[sa::my-id sa::ID]
357
+ bad = %w[sc:id fca312fb-5ff4-420d-862d-5d6d99ed6bcf]
358
+ good_and_bad('wf_serviceaccount_id?',
359
+ 'InvalidServiceAccountId', good, bad)
360
+ end
361
+
362
+ def test_permission
363
+ good = %w[events_management external_links_management]
364
+ bad = ['events management', 'event_management', 'EVENT_MANAGEMENT']
365
+ good_and_bad('wf_permission?',
366
+ 'InvalidPermission', good, bad)
367
+ end
354
368
  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: 3.3.4
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Fisher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-18 00:00:00.000000000 Z
11
+ date: 2019-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -214,6 +214,7 @@ files:
214
214
  - lib/wavefront-sdk/report.rb
215
215
  - lib/wavefront-sdk/savedsearch.rb
216
216
  - lib/wavefront-sdk/search.rb
217
+ - lib/wavefront-sdk/serviceaccount.rb
217
218
  - lib/wavefront-sdk/settings.rb
218
219
  - lib/wavefront-sdk/source.rb
219
220
  - lib/wavefront-sdk/stdlib/array.rb
@@ -282,6 +283,7 @@ files:
282
283
  - spec/wavefront-sdk/resources/user_responses/list.json
283
284
  - spec/wavefront-sdk/savedsearch_spec.rb
284
285
  - spec/wavefront-sdk/search_spec.rb
286
+ - spec/wavefront-sdk/serviceaccount_spec.rb
285
287
  - spec/wavefront-sdk/settings_spec.rb
286
288
  - spec/wavefront-sdk/source_spec.rb
287
289
  - spec/wavefront-sdk/stdlib/array_spec.rb
@@ -373,6 +375,7 @@ test_files:
373
375
  - spec/wavefront-sdk/resources/user_responses/list.json
374
376
  - spec/wavefront-sdk/savedsearch_spec.rb
375
377
  - spec/wavefront-sdk/search_spec.rb
378
+ - spec/wavefront-sdk/serviceaccount_spec.rb
376
379
  - spec/wavefront-sdk/settings_spec.rb
377
380
  - spec/wavefront-sdk/source_spec.rb
378
381
  - spec/wavefront-sdk/stdlib/array_spec.rb