wavefront-sdk 6.0.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +4 -4
  3. data/.github/workflows/test.yml +2 -2
  4. data/.rubocop.yml +1 -3
  5. data/Gemfile +11 -0
  6. data/HISTORY.md +32 -4
  7. data/README.md +3 -3
  8. data/lib/wavefront-sdk/accesspolicy.rb +37 -0
  9. data/lib/wavefront-sdk/account.rb +28 -0
  10. data/lib/wavefront-sdk/alert.rb +29 -10
  11. data/lib/wavefront-sdk/api_mixins/tag.rb +12 -12
  12. data/lib/wavefront-sdk/apitoken.rb +29 -2
  13. data/lib/wavefront-sdk/cloudintegration.rb +10 -8
  14. data/lib/wavefront-sdk/cluster.rb +18 -0
  15. data/lib/wavefront-sdk/core/api_caller.rb +3 -9
  16. data/lib/wavefront-sdk/core/exception.rb +4 -0
  17. data/lib/wavefront-sdk/core/response.rb +1 -1
  18. data/lib/wavefront-sdk/credentials.rb +2 -2
  19. data/lib/wavefront-sdk/dashboard.rb +7 -6
  20. data/lib/wavefront-sdk/defs/version.rb +1 -1
  21. data/lib/wavefront-sdk/derivedmetric.rb +7 -6
  22. data/lib/wavefront-sdk/event.rb +5 -5
  23. data/lib/wavefront-sdk/externallink.rb +3 -3
  24. data/lib/wavefront-sdk/ingestionpolicy.rb +32 -5
  25. data/lib/wavefront-sdk/integration.rb +14 -4
  26. data/lib/wavefront-sdk/internals.rb +93 -0
  27. data/lib/wavefront-sdk/maintenancewindow.rb +4 -4
  28. data/lib/wavefront-sdk/message.rb +1 -1
  29. data/lib/wavefront-sdk/metric.rb +2 -2
  30. data/lib/wavefront-sdk/metric_helper.rb +1 -1
  31. data/lib/wavefront-sdk/metricspolicy.rb +3 -3
  32. data/lib/wavefront-sdk/monitoredapplication.rb +55 -0
  33. data/lib/wavefront-sdk/notificant.rb +4 -4
  34. data/lib/wavefront-sdk/paginator/base.rb +1 -1
  35. data/lib/wavefront-sdk/proxy.rb +26 -4
  36. data/lib/wavefront-sdk/role.rb +2 -2
  37. data/lib/wavefront-sdk/savedsearch.rb +4 -4
  38. data/lib/wavefront-sdk/search.rb +9 -7
  39. data/lib/wavefront-sdk/source.rb +6 -6
  40. data/lib/wavefront-sdk/spansamplingpolicy.rb +126 -0
  41. data/lib/wavefront-sdk/stdlib/string.rb +1 -1
  42. data/lib/wavefront-sdk/support/mixins.rb +1 -1
  43. data/lib/wavefront-sdk/support/parse_time.rb +1 -1
  44. data/lib/wavefront-sdk/user.rb +5 -5
  45. data/lib/wavefront-sdk/usergroup.rb +2 -2
  46. data/lib/wavefront-sdk/validators.rb +31 -8
  47. data/lib/wavefront-sdk/webhook.rb +3 -3
  48. data/lib/wavefront-sdk/write.rb +1 -0
  49. data/lib/wavefront-sdk/writers/api.rb +31 -8
  50. data/lib/wavefront-sdk/writers/core.rb +1 -1
  51. data/lib/wavefront_sdk.rb +1 -1
  52. data/spec/constants.rb +2 -2
  53. data/spec/spec_helper.rb +1 -1
  54. data/spec/wavefront-sdk/accesspolicy_spec.rb +53 -0
  55. data/spec/wavefront-sdk/account_spec.rb +32 -1
  56. data/spec/wavefront-sdk/alert_spec.rb +17 -0
  57. data/spec/wavefront-sdk/api_mixins/user_mixins_spec.rb +1 -1
  58. data/spec/wavefront-sdk/apitoken_spec.rb +12 -0
  59. data/spec/wavefront-sdk/cluster_spec.rb +13 -0
  60. data/spec/wavefront-sdk/core/api_caller_spec.rb +1 -1
  61. data/spec/wavefront-sdk/core/api_spec.rb +2 -2
  62. data/spec/wavefront-sdk/core/logger_spec.rb +1 -1
  63. data/spec/wavefront-sdk/core/response_spec.rb +1 -1
  64. data/spec/wavefront-sdk/credentials_spec.rb +11 -15
  65. data/spec/wavefront-sdk/distribution_spec.rb +1 -1
  66. data/spec/wavefront-sdk/ingestionpolicy_spec.rb +11 -0
  67. data/spec/wavefront-sdk/integration_spec.rb +4 -0
  68. data/spec/wavefront-sdk/internals_spec.rb +62 -0
  69. data/spec/wavefront-sdk/metric_helper_spec.rb +1 -1
  70. data/spec/wavefront-sdk/metricspolicy_spec.rb +3 -3
  71. data/spec/wavefront-sdk/misc_spec.rb +3 -3
  72. data/spec/wavefront-sdk/monitoredapplication_spec.rb +35 -0
  73. data/spec/wavefront-sdk/paginator/base_spec.rb +1 -1
  74. data/spec/wavefront-sdk/paginator/post_spec.rb +1 -1
  75. data/spec/wavefront-sdk/proxy_spec.rb +14 -0
  76. data/spec/wavefront-sdk/resources/swagger.spec.gz +0 -0
  77. data/spec/wavefront-sdk/savedsearch_spec.rb +2 -2
  78. data/spec/wavefront-sdk/spansamplingpolicy_spec.rb +47 -0
  79. data/spec/wavefront-sdk/spy_spec.rb +1 -1
  80. data/spec/wavefront-sdk/stdlib/array_spec.rb +1 -1
  81. data/spec/wavefront-sdk/stdlib/hash_spec.rb +1 -1
  82. data/spec/wavefront-sdk/stdlib/string_spec.rb +1 -1
  83. data/spec/wavefront-sdk/support/mixins_spec.rb +1 -1
  84. data/spec/wavefront-sdk/support/parse_time_spec.rb +1 -1
  85. data/spec/wavefront-sdk/unstable/chart_spec.rb +1 -1
  86. data/spec/wavefront-sdk/usage_spec.rb +0 -1
  87. data/spec/wavefront-sdk/user_spec.rb +2 -2
  88. data/spec/wavefront-sdk/validators_spec.rb +17 -1
  89. data/spec/wavefront-sdk/write_spec.rb +1 -1
  90. data/spec/wavefront-sdk/writers/api_spec.rb +1 -1
  91. data/spec/wavefront-sdk/writers/core_spec.rb +1 -1
  92. data/spec/wavefront-sdk/writers/http_spec.rb +1 -1
  93. data/spec/wavefront-sdk/writers/proxy_spec.rb +1 -1
  94. data/spec/wavefront-sdk/writers/socket_spec.rb +1 -1
  95. data/spec/wavefront-sdk/writers/summary_spec.rb +1 -1
  96. data/wavefront-sdk.gemspec +4 -15
  97. metadata +22 -224
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 839f24e0a1a324b6965cb8aec1c0516bcb7c193215bc3cb6c1351f888bd49863
4
- data.tar.gz: 97ba3cce211abdef8d1b08265279a2998f968a6f85a58290efe26d8109314940
3
+ metadata.gz: 81df2a4acef6e05c259a4c835aa9591dce558c15eb42771c1cfd722736745e1a
4
+ data.tar.gz: 3315abd4368904f2debce8df47ce4a0654c58b2e8112c1c241c15d23ec5717fb
5
5
  SHA512:
6
- metadata.gz: 2d72451c46077024d79451aaea09efec073db0dcfb6dfb7601382973f80b14c99cd3b732bf57ec09a1ec962938b2219470676ba84c47b27051b5d2970cdeb8ef
7
- data.tar.gz: fdf2b294468db11835722f3ffbcbac2e77a42a12d8083c4e7536f637659bf8e063de0b75f023e71a46d2a25e942ad197e16e70a4229db5142b741542dbaaf2f7
6
+ metadata.gz: 107545fb991c8dac3165ba90dc676b79d416bb16fff9a4a1551be4cdb4cea72910e3fdb6ab1731c858561064be5423b4d5605913a7d5fcb4e4e19d11a217976e
7
+ data.tar.gz: 006de9abcb517ef2feaef266c0578ac6ac36c60870cc510abf13cb4eee8ee69983a7eab41f3ca289e426f9cce11a9c9c9adf3b24c81e5b5e763fb793e9d0f3d6
@@ -11,14 +11,14 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
 
13
13
  steps:
14
- - uses: actions/checkout@v2
14
+ - uses: actions/checkout@v3
15
15
  - name: Set env
16
16
  run: echo "RELEASE_VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV
17
17
 
18
- - name: Set up Ruby 2.7
18
+ - name: Set up Ruby 3.2
19
19
  uses: ruby/setup-ruby@v1
20
20
  with:
21
- ruby-version: 2.7
21
+ ruby-version: 3.2
22
22
  - run: bundle install
23
23
 
24
24
  - name: Run tests
@@ -34,4 +34,4 @@ jobs:
34
34
  chmod 0600 ${HOME}/.gem/credentials
35
35
  gem push pkg/*.gem
36
36
  env:
37
- GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
37
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_PUSH_KEY}}"
@@ -9,9 +9,9 @@ jobs:
9
9
  runs-on: ubuntu-latest
10
10
  strategy:
11
11
  matrix:
12
- ruby-version: [2.5.9, 2.6.7, 2.7.3, 3.0.1]
12
+ ruby-version: [3.0, 3.1, 3.2]
13
13
  steps:
14
- - uses: actions/checkout@v2
14
+ - uses: actions/checkout@v3
15
15
  - name: Set up Ruby
16
16
  uses: ruby/setup-ruby@v1
17
17
  with:
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.5
4
+ TargetRubyVersion: 3.0
5
5
  NewCops: enable
6
6
 
7
7
  require:
@@ -14,7 +14,5 @@ Layout/LineLength:
14
14
  Max: 80
15
15
  Metrics/ClassLength:
16
16
  Max: 150
17
- Style/StringConcatenation:
18
- Enabled: false
19
17
  Style/OptionalBooleanParameter:
20
18
  Enabled: false
data/Gemfile CHANGED
@@ -2,3 +2,14 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
  gemspec
5
+
6
+ gem 'minitest', '~> 5.17', group: :development
7
+ gem 'rake', '~> 13.0', group: :development
8
+ gem 'rubocop', '~> 1.51', group: :development
9
+ gem 'rubocop-minitest', '~> 0.31', group: :development
10
+ gem 'rubocop-performance', '~> 1.19', group: :development
11
+ gem 'rubocop-rake', '~> 0.6', group: :development
12
+ gem 'simplecov', '~> 0.22', group: :development
13
+ gem 'spy', '~> 1.0', group: :development
14
+ gem 'webmock', '~> 3.19', group: :development
15
+ gem 'yard', '~> 0.9', group: :development
data/HISTORY.md CHANGED
@@ -1,14 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## 8.0.0 (2023-09-06)
4
+ * Drop support for Ruby 2.7 (Breaking change.)
5
+ * Correctly report errors when sending points to API.
6
+ * Bump dependencies.
7
+ * Add `Wavefront::AccessPolicy` class.
8
+ * Add `Wavefront::Cluster` class to cover "wavefront" endpoint.
9
+ * Add `Wavefront::Alert#check_query`.
10
+ * Add `Wavefront::Alert#preview`.
11
+ * Add `Wavefront::Internal` class to show API coverage.
12
+ * Add `Wavefront::Account#admins`.
13
+ * Add `Wavefront::Account#update_perms`.
14
+ * Add `Wavefront::Integration#manifest_min`.
15
+ * Add `Wavefront::Proxy#config`.
16
+ * Add `Wavefront::Proxy#preprocessor_rules`.
17
+ * Add `version` parameter to `Wavefront::IngestionPolicy#describe`.
18
+ * Add `Wavefront::IngestionPolicy#history`.
19
+ * Add `Wavefront::IngestionPolicy#revert`.
20
+ * Add `Wavefront::ApiToken#list_customer_tokens`.
21
+ * Add `Wavefront::ApiToken#describe_customer_token`.
22
+ * Add `Wavefront::ApiToken#revoke_customer_token`, though it does nothing.
23
+ * Add `Wavefront::MonitoredApplication` class.
24
+ * Add `Wavefront::SpanSamplingPolicy` class.
25
+
26
+ ## 7.0.0 (2023-01-19)
27
+ * Drop support for Ruby 2.5. (Breaking change.)
28
+ * Drop support for Ruby 2.6. (Breaking change.)
29
+ * Bugfix for `metricspolicy` API.
30
+
3
31
  ## 6.0.0 (2021-07-16)
4
32
  * Drop support for Ruby 2.4. (Breaking change.)
5
33
  * Change the name of the proxy writer from `socket` to `proxy`. (Breaking
6
34
  change.)
7
35
  * Change the name of the Unix datagram socket writer from `unix` to `socket`.
8
- * added `Wavefront::Event#alert_firing_details`.
9
- * added `Wavefront::Event#alert_queries_slug`.
10
- * added `Wavefront::Event#events`.
11
- * added `Wavefront::Event#alert_firings`.
36
+ * Add `Wavefront::Event#alert_firing_details`.
37
+ * Add `Wavefront::Event#alert_queries_slug`.
38
+ * Add `Wavefront::Event#events`.
39
+ * Add `Wavefront::Event#alert_firings`.
12
40
  * Add `Wavefront::MetricsPolicy`.
13
41
  * Add `Wavefront::Spy#deltas`.
14
42
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # wavefront-sdk
2
- [![Test](https://github.com/snltd/wavefront-sdk/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/snltd/wavefront-sdk/actions/workflows/test.yml) [![Release](https://github.com/snltd/wavefront-sdk/actions/workflows/release.yml/badge.svg?branch=master)](https://github.com/snltd/wavefront-sdk/actions/workflows/release.yml) [![Code Climate](https://codeclimate.com/github/snltd/wavefront-sdk/badges/gpa.svg)](https://codeclimate.com/github/snltd/wavefront-sdk) [![Issue Count](https://codeclimate.com/github/snltd/wavefront-sdk/badges/issue_count.svg)](https://codeclimate.com/github/snltd/wavefront-sdk) [![Gem Version](https://badge.fury.io/rb/wavefront-sdk.svg)](https://badge.fury.io/rb/wavefront-sdk) ![](http://ruby-gem-downloads-badge.herokuapp.com/wavefront-sdk?type=total)
3
-
2
+ [![Test](https://github.com/snltd/wavefront-sdk/actions/workflows/test.yml/badge.svg)](https://github.com/snltd/wavefront-sdk/actions/workflows/test.yml) [![Release](https://github.com/snltd/wavefront-sdk/actions/workflows/release.yml/badge.svg)](https://github.com/snltd/wavefront-sdk/actions/workflows/release.yml) [![Gem Version](https://badge.fury.io/rb/wavefront-sdk.png)](https://badge.fury.io/rb/wavefront-sdk)
3
+
4
4
  This is a Ruby SDK for v2 of
5
5
  [Wavefront](https://www.wavefront.com/)'s public API. It aims to be
6
6
  more lightweight, consistent, simple, and convenient than an
@@ -24,7 +24,7 @@ or to build locally,
24
24
  $ gem build wavefront-sdk.gemspec
25
25
  ```
26
26
 
27
- `wavefront-sdk` requires Ruby >= 2.5. All its dependencies are pure
27
+ `wavefront-sdk` requires Ruby >= 3.0. All its dependencies are pure
28
28
  Ruby, right the way down, so a compiler should never be required to
29
29
  install it.
30
30
 
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'core/api'
4
+
5
+ module Wavefront
6
+ #
7
+ # Manage and query the Wavefront access policy
8
+ #
9
+ class AccessPolicy < CoreApi
10
+ # GET /api/v2/accesspolicy
11
+ # Get the access policy
12
+ # @return [Wavefront::Response]
13
+ #
14
+ def describe
15
+ api.get('')
16
+ end
17
+
18
+ # PUT /api/v2/accesspolicy
19
+ # Update the access policy
20
+ # @param body [Hash] hash describing access policy
21
+ # @return [Wavefront::Response]
22
+ #
23
+ def update(body)
24
+ raise ArgumentError unless body.is_a?(Hash)
25
+
26
+ api.put('', body, 'application/json')
27
+ end
28
+
29
+ # GET /api/v2/accesspolicy/validate
30
+ # Validate a given url and ip address
31
+ # @return [Wavefront::Response]
32
+ #
33
+ def validate(ip)
34
+ api.get('validate', ip: ip)
35
+ end
36
+ end
37
+ end
@@ -44,6 +44,34 @@ module Wavefront
44
44
  api.get(id)
45
45
  end
46
46
 
47
+ # GET /api/v2/account/user/admin
48
+ # Get all users with Accounts permission
49
+ #
50
+ def admins
51
+ api.get('user/admin')
52
+ end
53
+
54
+ # PUT /api/v2/account/user/{id}
55
+ # Update user with given user groups and permissions.
56
+ #
57
+ # @param id [String] a Wavefront account ID
58
+ # @param body [Hash] key-value hash of the parameters you wish
59
+ # to change
60
+ # @param modify [true, false] if true, use {#describe()} to get
61
+ # a hash describing the existing object, and modify that with
62
+ # the new body. If false, pass the new body straight through.
63
+ # @return [Wavefront::Response]
64
+ #
65
+ def update_perms(id, body, modify = true)
66
+ wf_account_id?(id)
67
+ raise ArgumentError unless body.is_a?(Hash)
68
+
69
+ return api.put(['user', id], body, 'application/json') unless modify
70
+
71
+ api.put(['user', id], hash_for_update(describe(id).response, body),
72
+ 'application/json')
73
+ end
74
+
47
75
  # POST /api/v2/account/{id}/addRoles
48
76
  # Add specific roles to the account (user or service account)
49
77
  # @param id [String] ID of the account
@@ -44,7 +44,7 @@ module Wavefront
44
44
  api.post('', body, 'application/json')
45
45
  end
46
46
 
47
- # DELETE /api/v2/alert/id
47
+ # DELETE /api/v2/alert/{id}
48
48
  # Delete a specific alert.
49
49
  #
50
50
  # Deleting an active alert moves it to 'trash', from where it can
@@ -59,8 +59,8 @@ module Wavefront
59
59
  api.delete(id)
60
60
  end
61
61
 
62
- # GET /api/v2/alert/id
63
- # GET /api/v2/alert/id/history/version
62
+ # GET /api/v2/alert/{id}
63
+ # GET /api/v2/alert/{id}/history/{version}
64
64
  # Get a specific alert / Get a specific historical version of a
65
65
  # specific alert.
66
66
  #
@@ -76,9 +76,10 @@ module Wavefront
76
76
  api.get(fragments.uri_concat)
77
77
  end
78
78
 
79
- # Gets all the versions of the given alert
79
+ # GET /api/v2/alert/{id}/history
80
+ # Get the version history of a specific alert
80
81
  # @param id [String] ID of the alert
81
- # @reutrn [Wavefront::Resonse] where items is an array of integers
82
+ # @return [Wavefront::Response]
82
83
  #
83
84
  def versions(id)
84
85
  wf_alert_id?(id)
@@ -91,7 +92,7 @@ module Wavefront
91
92
  resp
92
93
  end
93
94
 
94
- # PUT /api/v2/alert/id
95
+ # PUT /api/v2/alert/{id}
95
96
  # Update a specific alert.
96
97
  #
97
98
  # @param id [String] a Wavefront alert ID
@@ -128,7 +129,7 @@ module Wavefront
128
129
  v: version }, 'application/json')
129
130
  end
130
131
 
131
- # GET /api/v2/alert/id/history
132
+ # GET /api/v2/alert/{id}/history
132
133
  # Get the version history of a specific alert.
133
134
  #
134
135
  # @param id [String] ID of the alert
@@ -151,7 +152,7 @@ module Wavefront
151
152
  api.post([id, 'install'].uri_concat, nil)
152
153
  end
153
154
 
154
- # POST /api/v2/alert/id/snooze
155
+ # POST /api/v2/alert/{id}/snooze
155
156
  # Snooze a specific alert for some number of seconds.
156
157
  #
157
158
  # @param id [String] ID of the alert
@@ -169,7 +170,7 @@ module Wavefront
169
170
  wf_alert_id?(id)
170
171
  end
171
172
 
172
- # POST /api/v2/alert/id/undelete
173
+ # POST /api/v2/alert/{id}/undelete
173
174
  # Undelete a specific alert.
174
175
  #
175
176
  # @param id [String] ID of the alert
@@ -188,7 +189,7 @@ module Wavefront
188
189
  api.post([id, 'uninstall'].uri_concat, nil)
189
190
  end
190
191
 
191
- # POST /api/v2/alert/id/unsnooze
192
+ # POST /api/v2/alert/{id}/unsnooze
192
193
  # Unsnooze a specific alert.
193
194
  #
194
195
  # @param id [String] ID of the alert
@@ -199,6 +200,24 @@ module Wavefront
199
200
  api.post([id, 'unsnooze'].uri_concat)
200
201
  end
201
202
 
203
+ # POST /api/v2/alert/checkQuery
204
+ # Return the type of provided query.
205
+ # @param query [Hash] description of query
206
+ # @return [Wavefront::Response]
207
+ #
208
+ def check_query(query)
209
+ api.post('checkQuery', query, 'application/json')
210
+ end
211
+
212
+ # POST /api/v2/alert/preview
213
+ # Get all the notification preview for a specific alert
214
+ # @param alert [Hash] description of alert
215
+ # @return [Wavefront::Response]
216
+ #
217
+ def preview(alert)
218
+ api.post('preview', alert, 'application/json')
219
+ end
220
+
202
221
  # GET /api/v2/alert/summary
203
222
  # Count alerts of various statuses for a customer
204
223
  #
@@ -9,10 +9,10 @@ module Wavefront
9
9
  # valid_id? method to perform ID validation.
10
10
  #
11
11
  module Tag
12
- # GET /api/v2/{object}/id/tag
13
- # Get all tags associated with a specific object.
12
+ # GET /api/v2/{entity}/{id}/tag
13
+ # Get all tags associated with a specific entity.
14
14
  #
15
- # @param id [String] ID of the object
15
+ # @param id [String] ID of the entity
16
16
  # @return [Wavefront::Response]
17
17
  #
18
18
  def tags(id)
@@ -20,10 +20,10 @@ module Wavefront
20
20
  api.get([id, 'tag'].uri_concat)
21
21
  end
22
22
 
23
- # POST /api/v2/{object}/id/tag
24
- # Set all tags associated with a specific object.
23
+ # POST /api/v2/{entity}/{id}/tag
24
+ # Set all tags associated with a specific entity.
25
25
  #
26
- # @param id [String] ID of the object
26
+ # @param id [String] ID of the entity
27
27
  # @param tags [Array] list of tags to set.
28
28
  # @return [Wavefront::Response]
29
29
  #
@@ -34,10 +34,10 @@ module Wavefront
34
34
  api.post([id, 'tag'].uri_concat, tags.to_json, 'application/json')
35
35
  end
36
36
 
37
- # DELETE /api/v2/{object}/id/tag/tagValue
38
- # Remove a tag from a specific object.
37
+ # DELETE /api/v2/{entity}/{id}/tag/{tagValue}
38
+ # Remove a tag from a specific entity.
39
39
  #
40
- # @param id [String] ID of the object
40
+ # @param id [String] ID of the entity
41
41
  # @param tag [String] tag to delete
42
42
  # @return [Wavefront::Response]
43
43
  #
@@ -47,10 +47,10 @@ module Wavefront
47
47
  api.delete([id, 'tag', tag].uri_concat)
48
48
  end
49
49
 
50
- # PUT /api/v2/{object}/id/tag/tagValue
51
- # Add a tag to a specific object.
50
+ # PUT /api/v2/{entity}/{id}/tag/{tagValue}
51
+ # Add a tag to a specific entity.
52
52
  #
53
- # @param id [String] ID of the object
53
+ # @param id [String] ID of the entity
54
54
  # @param tag [String] tag to set.
55
55
  # @return [Wavefront::Response]
56
56
  #
@@ -25,7 +25,25 @@ module Wavefront
25
25
  api.post('', nil, 'application/json')
26
26
  end
27
27
 
28
- # DELETE /api/v2/apitoken/id
28
+ # GET /api/v2/apitoken/customertokens
29
+ # Get all api tokens for a customer
30
+ #
31
+ def list_customer_tokens
32
+ api.get('customertokens')
33
+ end
34
+
35
+ # GET /api/v2/apitoken/customertokens/{id}
36
+ # Get the specified api token for a customer
37
+ #
38
+ # @param id [String] ID of the api token
39
+ # @return [Wavefront::Response]
40
+ #
41
+ def describe_customer_token(id)
42
+ wf_apitoken_id?(id)
43
+ api.get(['customertokens', id].uri_concat)
44
+ end
45
+
46
+ # DELETE /api/v2/apitoken/{id}
29
47
  # Delete the specified api token
30
48
  #
31
49
  # @param id [String] ID of the api token
@@ -36,7 +54,7 @@ module Wavefront
36
54
  api.delete(id)
37
55
  end
38
56
 
39
- # PUT /api/v2/apitoken/id
57
+ # PUT /api/v2/apitoken/{id}
40
58
  # Update the name of the specified api token
41
59
  #
42
60
  # @param id [String] ID of the API token
@@ -99,5 +117,14 @@ module Wavefront
99
117
  api.put(['serviceaccount', id, token_id].uri_concat,
100
118
  { tokenID: token_id, tokenName: name }, 'application/json')
101
119
  end
120
+
121
+ # PUT /api/v2/apitoken/customertokens/revoke
122
+ # Delete the specified api token for a customer
123
+ #
124
+ # This appears to be only for use by the web API.
125
+ #
126
+ def revoke_customer_token
127
+ raise 'Unsupported API path'
128
+ end
102
129
  end
103
130
  end
@@ -32,7 +32,7 @@ module Wavefront
32
32
  api.post('', body, 'application/json')
33
33
  end
34
34
 
35
- # DELETE /api/v2/cloudintegration/id
35
+ # DELETE /api/v2/cloudintegration/{id}
36
36
  # Delete a specific cloud integration
37
37
  #
38
38
  # Deleting an active integration moves it to 'trash', from where
@@ -47,7 +47,7 @@ module Wavefront
47
47
  api.delete(id)
48
48
  end
49
49
 
50
- # GET /api/v2/cloudintegration/id
50
+ # GET /api/v2/cloudintegration/{id}
51
51
  # Get a specific cloud integration
52
52
  #
53
53
  # @param id [String] ID of the integration
@@ -58,7 +58,7 @@ module Wavefront
58
58
  api.get(id)
59
59
  end
60
60
 
61
- # PUT /api/v2/cloudintegration/id
61
+ # PUT /api/v2/cloudintegration/{id}
62
62
  # Update a specific cloud integration
63
63
  #
64
64
  # @param id [String] ID of the integration
@@ -91,7 +91,7 @@ module Wavefront
91
91
  api.post([id, 'enable'].uri_concat)
92
92
  end
93
93
 
94
- # POST /api/v2/cloudintegration/id/undelete
94
+ # POST /api/v2/cloudintegration/{id}/undelete
95
95
  # Undelete a specific cloud integration
96
96
  #
97
97
  # @param id [String] ID of the integration
@@ -102,14 +102,16 @@ module Wavefront
102
102
  api.post([id, 'undelete'].uri_concat)
103
103
  end
104
104
 
105
- # POST /api/v2/cloudintegration/awsExternalIdCreate an external id
105
+ # POST /api/v2/cloudintegration/awsExternalId
106
+ # Create an external id
106
107
  # @return [Wavefront::Response]
107
108
  #
108
109
  def create_aws_external_id
109
110
  api.post('awsExternalId', nil, 'application/json')
110
111
  end
111
112
 
112
- # DELETE /api/v2/cloudintegration/awsExternalId/{id}DELETEs an external id
113
+ # DELETE /api/v2/cloudintegration/awsExternalId/{id}
114
+ # Deletes an external id
113
115
  # that was created by Wavefront
114
116
  # @param id [String] AWS external ID
115
117
  # @return [Wavefront::Response]
@@ -119,8 +121,8 @@ module Wavefront
119
121
  api.delete(['awsExternalId', external_id].uri_concat)
120
122
  end
121
123
 
122
- # GET /api/v2/cloudintegration/awsExternalId/{id}GETs (confirms) a valid
123
- # external id that was created by Wavefront
124
+ # GET /api/v2/cloudintegration/awsExternalId/{id}
125
+ # GETs (confirms) a valid external id that was created by Wavefront
124
126
  # @param id [String] AWS external ID
125
127
  # @return [Wavefront::Response]
126
128
  #
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'core/api'
4
+
5
+ module Wavefront
6
+ #
7
+ # Query Wavefront cluster info. The API docs call this "wavefront", but that
8
+ # confuses everything.
9
+ #
10
+ class Cluster < CoreApi
11
+ # GET /api/v2/cluster/info
12
+ # get cluster info
13
+ #
14
+ def describe
15
+ api.get('info')
16
+ end
17
+ end
18
+ end
@@ -133,8 +133,8 @@ module Wavefront
133
133
  #
134
134
  def post(path, body = nil, ctype = 'text/plain')
135
135
  body = body.to_json unless body.is_a?(String)
136
- make_call(mk_conn(path, 'Content-Type': ctype,
137
- Accept: 'application/json'),
136
+ make_call(mk_conn(path, 'Content-Type': ctype,
137
+ Accept: 'application/json'),
138
138
  :post, nil, body)
139
139
  end
140
140
 
@@ -229,14 +229,8 @@ module Wavefront
229
229
  return if noop
230
230
 
231
231
  pp args if debug
232
-
233
232
  resp = conn.public_send(method, *args)
234
-
235
- if debug
236
- require 'pp'
237
- pp resp
238
- end
239
-
233
+ pp resp if debug
240
234
  respond(resp)
241
235
  end
242
236
 
@@ -53,6 +53,8 @@ module Wavefront
53
53
 
54
54
  class InvalidMaintenanceWindowId < RuntimeError; end
55
55
 
56
+ class InvalidMonitoredApplicationId < RuntimeError; end
57
+
56
58
  class InvalidMonitoredClusterId < RuntimeError; end
57
59
 
58
60
  class InvalidMessageId < RuntimeError; end
@@ -89,6 +91,8 @@ module Wavefront
89
91
 
90
92
  class InvalidSourceId < RuntimeError; end
91
93
 
94
+ class InvalidSpanSamplingPolicyId < RuntimeError; end
95
+
92
96
  class InvalidString < RuntimeError; end
93
97
 
94
98
  class InvalidTag < RuntimeError; end
@@ -51,7 +51,7 @@ module Wavefront
51
51
  # Were there items in the response?
52
52
  #
53
53
  def empty?
54
- response.items.size.zero?
54
+ response.items.empty?
55
55
  rescue StandardError
56
56
  false
57
57
  end
@@ -82,8 +82,8 @@ module Wavefront
82
82
  Array(Pathname.new(opts[:file]))
83
83
  else
84
84
  [Pathname.new('/etc/wavefront/credentials'),
85
- Pathname.new(ENV['HOME']) + '.wavefront.conf',
86
- Pathname.new(ENV['HOME']) + '.wavefront']
85
+ Pathname.new(Dir.home).join('.wavefront.conf'),
86
+ Pathname.new(Dir.home).join('.wavefront')]
87
87
  end
88
88
  end
89
89
 
@@ -40,7 +40,7 @@ module Wavefront
40
40
  api.post('', body, 'application/json')
41
41
  end
42
42
 
43
- # DELETE /api/v2/dashboard/id
43
+ # DELETE /api/v2/dashboard/{id}
44
44
  # Delete a specific dashboard.
45
45
  # Deleting an active dashboard moves it to 'trash', from where
46
46
  # it can be restored with an #undelete operation. Deleting a
@@ -54,7 +54,8 @@ module Wavefront
54
54
  api.delete(id)
55
55
  end
56
56
 
57
- # GET /api/v2/dashboard/id
57
+ # GET /api/v2/dashboard/{id}
58
+ # GET /api/v2/dashboard/{id}/history/{version}
58
59
  # Get a specific dashboard / Get a specific historical version
59
60
  # of a specific dashboard.
60
61
  #
@@ -70,10 +71,10 @@ module Wavefront
70
71
  api.get(fragments.uri_concat)
71
72
  end
72
73
 
73
- # PUT /api/v2/dashboard/id
74
+ # PUT /api/v2/dashboard/{id}
74
75
  # Update a specific dashboard.
75
76
  #
76
- # @param id [String] a Wavefront alert ID
77
+ # @param id [String] a Wavefront dashboard ID
77
78
  # @param body [Hash] key-value hash of the parameters you wish
78
79
  # to change
79
80
  # @param modify [true, false] if true, use {#describe()} to get
@@ -103,7 +104,7 @@ module Wavefront
103
104
  end
104
105
  alias favourite favorite
105
106
 
106
- # GET /api/v2/dashboard/id/history
107
+ # GET /api/v2/dashboard/{id}/history
107
108
  # Get the version history of a dashboard.
108
109
  #
109
110
  # @param id [String] ID of the dashboard
@@ -114,7 +115,7 @@ module Wavefront
114
115
  api.get([id, 'history'].uri_concat)
115
116
  end
116
117
 
117
- # POST /api/v2/dashboard/id/undelete
118
+ # POST /api/v2/dashboard/{id}/undelete
118
119
  # Move a dashboard from 'trash' back into active service.
119
120
  #
120
121
  # @param id [String] ID of the dashboard
@@ -2,5 +2,5 @@
2
2
 
3
3
  require 'pathname'
4
4
 
5
- WF_SDK_VERSION = '6.0.0'
5
+ WF_SDK_VERSION = '8.0.0'
6
6
  WF_SDK_LOCATION = Pathname.new(__dir__).parent.parent.parent