wavefront-sdk 4.0.0 → 5.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +12 -1
- data/HISTORY.md +28 -0
- data/README.md +3 -2
- data/lib/wavefront-sdk/account.rb +104 -3
- data/lib/wavefront-sdk/api_mixins/user.rb +10 -0
- data/lib/wavefront-sdk/cloudintegration.rb +27 -0
- data/lib/wavefront-sdk/core/exception.rb +3 -0
- data/lib/wavefront-sdk/credentials.rb +28 -9
- data/lib/wavefront-sdk/defs/version.rb +3 -1
- data/lib/wavefront-sdk/distribution.rb +2 -0
- data/lib/wavefront-sdk/paginator/base.rb +21 -15
- data/lib/wavefront-sdk/query.rb +0 -1
- data/lib/wavefront-sdk/role.rb +128 -0
- data/lib/wavefront-sdk/spy.rb +126 -0
- data/lib/wavefront-sdk/stdlib/array.rb +1 -1
- data/lib/wavefront-sdk/user.rb +31 -0
- data/lib/wavefront-sdk/usergroup.rb +17 -16
- data/lib/wavefront-sdk/validators.rb +31 -7
- data/lib/wavefront-sdk/writers/core.rb +2 -2
- data/spec/.rubocop.yml +13 -3
- data/spec/support/minitest_assertions.rb +5 -11
- data/spec/wavefront-sdk/account_spec.rb +107 -1
- data/spec/wavefront-sdk/cloudintegration_spec.rb +38 -0
- data/spec/wavefront-sdk/core/logger_spec.rb +3 -3
- data/spec/wavefront-sdk/credentials_spec.rb +5 -4
- data/spec/wavefront-sdk/metric_helper_spec.rb +1 -1
- data/spec/wavefront-sdk/role_spec.rb +96 -0
- data/spec/wavefront-sdk/{unstable/spy_spec.rb → spy_spec.rb} +3 -3
- data/spec/wavefront-sdk/user_spec.rb +8 -0
- data/spec/wavefront-sdk/usergroup_spec.rb +21 -11
- data/spec/wavefront-sdk/validators_spec.rb +16 -0
- data/spec/wavefront-sdk/writers/core_spec.rb +1 -1
- data/wavefront-sdk.gemspec +6 -6
- metadata +23 -24
- data/lib/wavefront-sdk/monitoredcluster.rb +0 -93
- data/lib/wavefront-sdk/unstable/spy.rb +0 -134
- data/spec/wavefront-sdk/monitoredcluster_spec.rb +0 -55
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require_relative '
|
5
|
-
require_relative '
|
4
|
+
require_relative '../spec_helper'
|
5
|
+
require_relative '../../lib/wavefront-sdk/spy'
|
6
6
|
|
7
7
|
# Unit tests for Spy class
|
8
8
|
#
|
@@ -10,7 +10,7 @@ class WavefrontSpyTest < MiniTest::Test
|
|
10
10
|
attr_reader :wf
|
11
11
|
|
12
12
|
def setup
|
13
|
-
@wf = Wavefront::
|
13
|
+
@wf = Wavefront::Spy.new(CREDS)
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_points
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
require 'logger'
|
4
5
|
require_relative '../spec_helper'
|
5
6
|
require_relative '../test_mixins/general'
|
6
7
|
|
@@ -13,6 +14,13 @@ class WavefrontUserTest < WavefrontTestBase
|
|
13
14
|
include WavefrontTest::Describe
|
14
15
|
include WavefrontTest::Update
|
15
16
|
|
17
|
+
# Override the parent constructor so we can suppress all the 'deprecated'
|
18
|
+
# log messages
|
19
|
+
#
|
20
|
+
def setup
|
21
|
+
@wf = Wavefront::User.new(CREDS, logger: Logger.new('/dev/null'))
|
22
|
+
end
|
23
|
+
|
16
24
|
def test_list
|
17
25
|
assert_gets('/api/v2/user') { wf.list }
|
18
26
|
end
|
@@ -7,7 +7,8 @@ require_relative '../test_mixins/general'
|
|
7
7
|
# Unit tests for WavefrontUserGroup
|
8
8
|
#
|
9
9
|
class WavefrontUserGroupTest < WavefrontTestBase
|
10
|
-
attr_reader :users, :groups, :permission, :invalid_groups, :invalid_users
|
10
|
+
attr_reader :users, :groups, :permission, :invalid_groups, :invalid_users,
|
11
|
+
:roles, :invalid_roles
|
11
12
|
|
12
13
|
include WavefrontTest::Create
|
13
14
|
include WavefrontTest::Delete
|
@@ -39,22 +40,28 @@ class WavefrontUserGroupTest < WavefrontTestBase
|
|
39
40
|
assert_invalid_id { wf.remove_users_from_group(invalid_id, users) }
|
40
41
|
end
|
41
42
|
|
42
|
-
def
|
43
|
-
assert_posts("/api/v2/usergroup
|
44
|
-
|
45
|
-
wf.grant(permission, groups)
|
43
|
+
def test_add_roles_to_group
|
44
|
+
assert_posts("/api/v2/usergroup/#{id}/addRoles", roles.to_json) do
|
45
|
+
wf.add_roles_to_group(id, roles)
|
46
46
|
end
|
47
47
|
|
48
|
-
|
48
|
+
assert_raises(Wavefront::Exception::InvalidRoleId) do
|
49
|
+
wf.add_roles_to_group(id, invalid_roles)
|
50
|
+
end
|
51
|
+
|
52
|
+
assert_invalid_id { wf.add_roles_to_group(invalid_id, roles) }
|
49
53
|
end
|
50
54
|
|
51
|
-
def
|
52
|
-
assert_posts("/api/v2/usergroup
|
53
|
-
|
54
|
-
|
55
|
+
def test_remove_roles_from_group
|
56
|
+
assert_posts("/api/v2/usergroup/#{id}/removeRoles", roles.to_json) do
|
57
|
+
wf.remove_roles_from_group(id, roles)
|
58
|
+
end
|
59
|
+
|
60
|
+
assert_raises(Wavefront::Exception::InvalidRoleId) do
|
61
|
+
wf.remove_roles_from_group(id, invalid_roles)
|
55
62
|
end
|
56
63
|
|
57
|
-
assert_invalid_id { wf.
|
64
|
+
assert_invalid_id { wf.remove_roles_from_group(invalid_id, roles) }
|
58
65
|
end
|
59
66
|
|
60
67
|
def setup_fixtures
|
@@ -63,7 +70,10 @@ class WavefrontUserGroupTest < WavefrontTestBase
|
|
63
70
|
@groups = %w[f8dc0c14-91a0-4ca9-8a2a-7d47f4db4672
|
64
71
|
2659191e-aad4-4302-a94e-9667e1517127]
|
65
72
|
@users = %w[someone@somewhere.com other@elsewhere.net]
|
73
|
+
@roles = %w[abcdef14-91a0-4ca9-8a2a-7d47f4db4672
|
74
|
+
fedcba1e-aad4-4302-a94e-9667e1517127]
|
66
75
|
@invalid_users = ['bad' * 500, '']
|
76
|
+
@invalid_roles = ['some nonsense']
|
67
77
|
end
|
68
78
|
|
69
79
|
private
|
@@ -401,4 +401,20 @@ class WavefrontValidatorsTest < MiniTest::Test
|
|
401
401
|
bad = ['a', 0.1, 0.99, 1, -1, 1.1]
|
402
402
|
good_and_bad('wf_sampling_value?', 'InvalidSamplingValue', good, bad)
|
403
403
|
end
|
404
|
+
|
405
|
+
def test_wf_role_id
|
406
|
+
good = %w[2bfdcac7-1c9c-4c4b-9b56-c41c22c586dc
|
407
|
+
17db4cc1-65f6-40a8-a1fa-6fcae460c4bd
|
408
|
+
fca312fb-5ff4-420d-862d-5d6d99ed6bcf
|
409
|
+
3a1957e0-459e-49e5-9209-3888a4e8ac5b]
|
410
|
+
|
411
|
+
bad = %w[fa312fb-5ff4-420d-862d-5d6d99ed6bcf thing 123]
|
412
|
+
good_and_bad('wf_role_id?', 'InvalidRoleId', good, bad)
|
413
|
+
end
|
414
|
+
|
415
|
+
def test_wf_aws_external_id
|
416
|
+
good = %w[ah5Z9dkr46jbvLtJ HqOM4mru5svd3uFp c1lBxILCBNxLKdx9]
|
417
|
+
bad = %w[h5Z9dkr46jbvLtJ HqOM4mru5svd3uFp3 c!lBx!LC*NxLKdx*]
|
418
|
+
good_and_bad('wf_aws_external_id?', 'InvalidAwsExternalId', good, bad)
|
419
|
+
end
|
404
420
|
end
|
data/wavefront-sdk.gemspec
CHANGED
@@ -27,12 +27,12 @@ Gem::Specification.new do |gem|
|
|
27
27
|
gem.add_dependency 'inifile', '~> 3.0'
|
28
28
|
gem.add_dependency 'map', '~> 6.6'
|
29
29
|
|
30
|
-
gem.add_development_dependency 'minitest', '~> 5.
|
31
|
-
gem.add_development_dependency 'rake', '~>
|
32
|
-
gem.add_development_dependency 'rubocop', '
|
33
|
-
gem.add_development_dependency 'simplecov', '~> 0.
|
34
|
-
gem.add_development_dependency 'spy', '
|
35
|
-
gem.add_development_dependency 'webmock', '~> 3.
|
30
|
+
gem.add_development_dependency 'minitest', '~> 5.14'
|
31
|
+
gem.add_development_dependency 'rake', '~> 13.0'
|
32
|
+
gem.add_development_dependency 'rubocop', '0.91.0'
|
33
|
+
gem.add_development_dependency 'simplecov', '~> 0.18'
|
34
|
+
gem.add_development_dependency 'spy', '1.0.0'
|
35
|
+
gem.add_development_dependency 'webmock', '~> 3.8'
|
36
36
|
gem.add_development_dependency 'yard', '~> 0.9'
|
37
37
|
|
38
38
|
gem.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
|
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:
|
4
|
+
version: 5.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Fisher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -72,68 +72,68 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '5.
|
75
|
+
version: '5.14'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '5.
|
82
|
+
version: '5.14'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '13.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '13.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubocop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 0.91.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 0.91.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0.
|
117
|
+
version: '0.18'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0.
|
124
|
+
version: '0.18'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: spy
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: 1.0.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 1.0.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '3.
|
145
|
+
version: '3.8'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '3.
|
152
|
+
version: '3.8'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: yard
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,7 +205,6 @@ files:
|
|
205
205
|
- lib/wavefront-sdk/message.rb
|
206
206
|
- lib/wavefront-sdk/metric.rb
|
207
207
|
- lib/wavefront-sdk/metric_helper.rb
|
208
|
-
- lib/wavefront-sdk/monitoredcluster.rb
|
209
208
|
- lib/wavefront-sdk/notificant.rb
|
210
209
|
- lib/wavefront-sdk/paginator/base.rb
|
211
210
|
- lib/wavefront-sdk/paginator/delete.rb
|
@@ -215,11 +214,13 @@ files:
|
|
215
214
|
- lib/wavefront-sdk/proxy.rb
|
216
215
|
- lib/wavefront-sdk/query.rb
|
217
216
|
- lib/wavefront-sdk/report.rb
|
217
|
+
- lib/wavefront-sdk/role.rb
|
218
218
|
- lib/wavefront-sdk/savedsearch.rb
|
219
219
|
- lib/wavefront-sdk/search.rb
|
220
220
|
- lib/wavefront-sdk/serviceaccount.rb
|
221
221
|
- lib/wavefront-sdk/settings.rb
|
222
222
|
- lib/wavefront-sdk/source.rb
|
223
|
+
- lib/wavefront-sdk/spy.rb
|
223
224
|
- lib/wavefront-sdk/stdlib/array.rb
|
224
225
|
- lib/wavefront-sdk/stdlib/hash.rb
|
225
226
|
- lib/wavefront-sdk/stdlib/string.rb
|
@@ -229,7 +230,6 @@ files:
|
|
229
230
|
- lib/wavefront-sdk/types/status.rb
|
230
231
|
- lib/wavefront-sdk/unstable/README.md
|
231
232
|
- lib/wavefront-sdk/unstable/chart.rb
|
232
|
-
- lib/wavefront-sdk/unstable/spy.rb
|
233
233
|
- lib/wavefront-sdk/unstable/unstable.rb
|
234
234
|
- lib/wavefront-sdk/usage.rb
|
235
235
|
- lib/wavefront-sdk/user.rb
|
@@ -276,7 +276,6 @@ files:
|
|
276
276
|
- spec/wavefront-sdk/message_spec.rb
|
277
277
|
- spec/wavefront-sdk/metric_helper_spec.rb
|
278
278
|
- spec/wavefront-sdk/metric_spec.rb
|
279
|
-
- spec/wavefront-sdk/monitoredcluster_spec.rb
|
280
279
|
- spec/wavefront-sdk/notificant_spec.rb
|
281
280
|
- spec/wavefront-sdk/paginator/base_spec.rb
|
282
281
|
- spec/wavefront-sdk/paginator/post_spec.rb
|
@@ -293,18 +292,19 @@ files:
|
|
293
292
|
- spec/wavefront-sdk/resources/user_responses/describe.json
|
294
293
|
- spec/wavefront-sdk/resources/user_responses/grant.json
|
295
294
|
- spec/wavefront-sdk/resources/user_responses/list.json
|
295
|
+
- spec/wavefront-sdk/role_spec.rb
|
296
296
|
- spec/wavefront-sdk/savedsearch_spec.rb
|
297
297
|
- spec/wavefront-sdk/search_spec.rb
|
298
298
|
- spec/wavefront-sdk/serviceaccount_spec.rb
|
299
299
|
- spec/wavefront-sdk/settings_spec.rb
|
300
300
|
- spec/wavefront-sdk/source_spec.rb
|
301
|
+
- spec/wavefront-sdk/spy_spec.rb
|
301
302
|
- spec/wavefront-sdk/stdlib/array_spec.rb
|
302
303
|
- spec/wavefront-sdk/stdlib/hash_spec.rb
|
303
304
|
- spec/wavefront-sdk/stdlib/string_spec.rb
|
304
305
|
- spec/wavefront-sdk/support/mixins_spec.rb
|
305
306
|
- spec/wavefront-sdk/support/parse_time_spec.rb
|
306
307
|
- spec/wavefront-sdk/unstable/chart_spec.rb
|
307
|
-
- spec/wavefront-sdk/unstable/spy_spec.rb
|
308
308
|
- spec/wavefront-sdk/usage_spec.rb
|
309
309
|
- spec/wavefront-sdk/user_spec.rb
|
310
310
|
- spec/wavefront-sdk/usergroup_spec.rb
|
@@ -336,8 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
336
336
|
- !ruby/object:Gem::Version
|
337
337
|
version: '0'
|
338
338
|
requirements: []
|
339
|
-
|
340
|
-
rubygems_version: 2.7.7
|
339
|
+
rubygems_version: 3.0.8
|
341
340
|
signing_key:
|
342
341
|
specification_version: 4
|
343
342
|
summary: SDK for Wavefront API v2
|
@@ -374,7 +373,6 @@ test_files:
|
|
374
373
|
- spec/wavefront-sdk/message_spec.rb
|
375
374
|
- spec/wavefront-sdk/metric_helper_spec.rb
|
376
375
|
- spec/wavefront-sdk/metric_spec.rb
|
377
|
-
- spec/wavefront-sdk/monitoredcluster_spec.rb
|
378
376
|
- spec/wavefront-sdk/notificant_spec.rb
|
379
377
|
- spec/wavefront-sdk/paginator/base_spec.rb
|
380
378
|
- spec/wavefront-sdk/paginator/post_spec.rb
|
@@ -391,18 +389,19 @@ test_files:
|
|
391
389
|
- spec/wavefront-sdk/resources/user_responses/describe.json
|
392
390
|
- spec/wavefront-sdk/resources/user_responses/grant.json
|
393
391
|
- spec/wavefront-sdk/resources/user_responses/list.json
|
392
|
+
- spec/wavefront-sdk/role_spec.rb
|
394
393
|
- spec/wavefront-sdk/savedsearch_spec.rb
|
395
394
|
- spec/wavefront-sdk/search_spec.rb
|
396
395
|
- spec/wavefront-sdk/serviceaccount_spec.rb
|
397
396
|
- spec/wavefront-sdk/settings_spec.rb
|
398
397
|
- spec/wavefront-sdk/source_spec.rb
|
398
|
+
- spec/wavefront-sdk/spy_spec.rb
|
399
399
|
- spec/wavefront-sdk/stdlib/array_spec.rb
|
400
400
|
- spec/wavefront-sdk/stdlib/hash_spec.rb
|
401
401
|
- spec/wavefront-sdk/stdlib/string_spec.rb
|
402
402
|
- spec/wavefront-sdk/support/mixins_spec.rb
|
403
403
|
- spec/wavefront-sdk/support/parse_time_spec.rb
|
404
404
|
- spec/wavefront-sdk/unstable/chart_spec.rb
|
405
|
-
- spec/wavefront-sdk/unstable/spy_spec.rb
|
406
405
|
- spec/wavefront-sdk/usage_spec.rb
|
407
406
|
- spec/wavefront-sdk/user_spec.rb
|
408
407
|
- spec/wavefront-sdk/usergroup_spec.rb
|
@@ -1,93 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'core/api'
|
4
|
-
require_relative 'api_mixins/tag'
|
5
|
-
|
6
|
-
module Wavefront
|
7
|
-
#
|
8
|
-
# Manage and query Wavefront monitored clusters
|
9
|
-
#
|
10
|
-
class MonitoredCluster < CoreApi
|
11
|
-
include Wavefront::Mixin::Tag
|
12
|
-
|
13
|
-
def update_keys
|
14
|
-
%i[id]
|
15
|
-
end
|
16
|
-
|
17
|
-
# GET /api/v2/monitoredcluster
|
18
|
-
# Get all monitored clusters
|
19
|
-
# @param offset [Integer] cluster at which the list begins
|
20
|
-
# @param limit [Integer] the number of clusters to return
|
21
|
-
# @return [Wavefront::Response]
|
22
|
-
#
|
23
|
-
def list(offset = 0, limit = 100)
|
24
|
-
api.get('', offset: offset, limit: limit)
|
25
|
-
end
|
26
|
-
|
27
|
-
# POST /api/v2/monitoredcluster
|
28
|
-
# Create a specific cluster
|
29
|
-
# @param body [Hash] a hash of parameters describing the cluster.
|
30
|
-
# Please refer to the Wavefront Swagger docs for key:value
|
31
|
-
# information
|
32
|
-
# @return [Wavefront::Response]
|
33
|
-
#
|
34
|
-
def create(body)
|
35
|
-
raise ArgumentError unless body.is_a?(Hash)
|
36
|
-
|
37
|
-
api.post('', body, 'application/json')
|
38
|
-
end
|
39
|
-
|
40
|
-
# DELETE /api/v2/monitoredcluster/{id}
|
41
|
-
# Delete a specific cluster
|
42
|
-
# @param id [String, Integer] ID of the maintenance cluster
|
43
|
-
# @return [Wavefront::Response]
|
44
|
-
#
|
45
|
-
def delete(id)
|
46
|
-
wf_monitoredcluster_id?(id)
|
47
|
-
api.delete(id)
|
48
|
-
end
|
49
|
-
|
50
|
-
# GET /api/v2/monitoredcluster/{id}
|
51
|
-
# Get a specific cluster
|
52
|
-
# @param id [String, Integer] ID of the cluster
|
53
|
-
# @return [Wavefront::Response]
|
54
|
-
#
|
55
|
-
def describe(id)
|
56
|
-
wf_monitoredcluster_id?(id)
|
57
|
-
api.get(id)
|
58
|
-
end
|
59
|
-
|
60
|
-
# PUT /api/v2/monitoredcluster/{id}
|
61
|
-
# Update a specific cluster
|
62
|
-
# @return [Wavefront::Response]
|
63
|
-
#
|
64
|
-
def update(id, body, modify = true)
|
65
|
-
wf_monitoredcluster_id?(id)
|
66
|
-
raise ArgumentError unless body.is_a?(Hash)
|
67
|
-
|
68
|
-
return api.put(id, body, 'application/json') unless modify
|
69
|
-
|
70
|
-
api.put(id, hash_for_update(describe(id).response, body),
|
71
|
-
'application/json')
|
72
|
-
end
|
73
|
-
|
74
|
-
# PUT /api/v2/monitoredcluster/merge/{id1}/{id2}
|
75
|
-
# Merge two monitored clusters. The first cluster will remain and the
|
76
|
-
# second cluster will be deleted, with its id added as an alias to the
|
77
|
-
# first cluster.
|
78
|
-
# @param id1 [String, Integer] ID of the target cluster
|
79
|
-
# @param id2 [String, Integer] ID of the other cluster
|
80
|
-
# @return [Wavefront::Response]
|
81
|
-
#
|
82
|
-
def merge(id1, id2)
|
83
|
-
wf_monitoredcluster_id?(id1)
|
84
|
-
wf_monitoredcluster_id?(id2)
|
85
|
-
|
86
|
-
api.put(['merge', id1, id2].uri_concat, nil, 'application/json')
|
87
|
-
end
|
88
|
-
|
89
|
-
def valid_id?(id)
|
90
|
-
wf_monitoredcluster_id?(id)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|