wavefront-sdk 5.0.1 → 5.1.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: e4f8e6e99d7124c4a1654be470312d6749c475d0cfbc23b33c72962d13fe0e1e
4
- data.tar.gz: d2f43cb3bf00ddacce6cd24e92578d9876cfcbfa6b05cbdf6db68a5fbba732d9
3
+ metadata.gz: 6fa47f9b8dc9c71f547e50131d53cfcdf5ae0142cd75f14558afd5303576a4cc
4
+ data.tar.gz: '08bea64a048f8e22e02c4b8b12fa6e413a9e26bbb1e5c55e26201ac873424812'
5
5
  SHA512:
6
- metadata.gz: b01743fb3be2eaa72ff58f857eac4f640354ec6264436e764b0f5852b987a54f16d5fde57235b29b3c7ed5623ebca1894d467da1624f56fb8a185c5becded20c
7
- data.tar.gz: 81953b85f6638f802619f8481f70a0e98129f26139ed06d70c28ce100b266dfd13fa1279112698e13a7ecf74364d781608ad3e20feb9c4451ef21070e511516a
6
+ metadata.gz: ea55156acfeaadce57ff846aa723c936c77f061730ef7f1e91b2b2919c51dfa2cc1b0652d1485905772397da24452332e34b15ea4bae713dd4abc8aa83477dc7
7
+ data.tar.gz: 953bbc44ca84d32194a231d9037ce8e47917a1895c148e1e0661c7125f24c6bba53e29d9a625b8b6d2744669b49cab99837429c0f22129fad4e6697fafb17988
data/HISTORY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.1.0 (2020-08-15)
4
+ * Add `create_aws_external_id`, `delete_aws_external_id`, and
5
+ `confirm_aws_external_id` methods to `Wavefront::CloudIntegration`.
6
+
3
7
  ## 5.0.1 (2020-07-08)
4
8
  * Reinstate `Wavefront::Role#grant` and `Wavefront::Role#revoke`, which were
5
9
  accidentally removed prior to release of 5.0.0.
@@ -101,5 +101,32 @@ module Wavefront
101
101
  wf_cloudintegration_id?(id)
102
102
  api.post([id, 'undelete'].uri_concat)
103
103
  end
104
+
105
+ # POST /api/v2/cloudintegration/awsExternalIdCreate an external id
106
+ # @return [Wavefront::Response]
107
+ #
108
+ def create_aws_external_id
109
+ api.post('awsExternalId', nil, 'application/json')
110
+ end
111
+
112
+ # DELETE /api/v2/cloudintegration/awsExternalId/{id}DELETEs an external id
113
+ # that was created by Wavefront
114
+ # @param id [String] AWS external ID
115
+ # @return [Wavefront::Response]
116
+ #
117
+ def delete_aws_external_id(external_id)
118
+ wf_aws_external_id?(external_id)
119
+ api.delete(['awsExternalId', external_id].uri_concat)
120
+ end
121
+
122
+ # GET /api/v2/cloudintegration/awsExternalId/{id}GETs (confirms) a valid
123
+ # external id that was created by Wavefront
124
+ # @param id [String] AWS external ID
125
+ # @return [Wavefront::Response]
126
+ #
127
+ def confirm_aws_external_id(external_id)
128
+ wf_aws_external_id?(external_id)
129
+ api.get(['awsExternalId', external_id].uri_concat)
130
+ end
104
131
  end
105
132
  end
@@ -12,6 +12,7 @@ module Wavefront
12
12
  class InvalidAlertId < RuntimeError; end
13
13
  class InvalidAlertSeverity < RuntimeError; end
14
14
  class InvalidApiTokenId < RuntimeError; end
15
+ class InvalidAwsExternalId < RuntimeError; end
15
16
  class InvalidConfigFile < RuntimeError; end
16
17
  class InvalidCloudIntegrationId < RuntimeError; end
17
18
  class InvalidDashboardId < RuntimeError; end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- WF_SDK_VERSION = '5.0.1'
3
+ WF_SDK_VERSION = '5.1.0'
4
4
  WF_SDK_LOCATION = Pathname.new(__dir__).parent.parent.parent
@@ -626,6 +626,19 @@ module Wavefront
626
626
 
627
627
  raise Wavefront::Exception::InvalidRoleId, id
628
628
  end
629
+
630
+ # Ensure the given argument is a valid AWS external ID, used in the AWS
631
+ # cloud integration.
632
+ # @param id [String] the external ID to validate
633
+ # @return true if the external ID is valid
634
+ # @raise Wavefront::Exception::InvalidAwsExternalId if the external ID is
635
+ # not valid
636
+ #
637
+ def wf_aws_external_id?(id)
638
+ return true if id.is_a?(String) && id =~ /^[a-z0-9A-Z]{16}$/
639
+
640
+ raise Wavefront::Exception::InvalidAwsExternalId, id
641
+ end
629
642
  end
630
643
  # rubocop:enable Metrics/ModuleLength
631
644
  end
@@ -37,6 +37,36 @@ class WavefrontCloudIntegrationTest < WavefrontTestBase
37
37
  assert_raises(ArgumentError) { wf.disable }
38
38
  end
39
39
 
40
+ def test_create_aws_external_id
41
+ assert_posts('/api/v2/cloudintegration/awsExternalId', nil, :json) do
42
+ wf.create_aws_external_id
43
+ end
44
+ end
45
+
46
+ def test_delete_aws_external_id
47
+ assert_deletes("/api/v2/cloudintegration/awsExternalId/#{external_id}") do
48
+ wf.delete_aws_external_id(external_id)
49
+ end
50
+
51
+ assert_raises(Wavefront::Exception::InvalidAwsExternalId) do
52
+ wf.delete_aws_external_id(invalid_external_id)
53
+ end
54
+
55
+ assert_raises(ArgumentError) { wf.delete_aws_external_id }
56
+ end
57
+
58
+ def test_confirm_aws_external_id
59
+ assert_gets("/api/v2/cloudintegration/awsExternalId/#{external_id}") do
60
+ wf.confirm_aws_external_id(external_id)
61
+ end
62
+
63
+ assert_raises(Wavefront::Exception::InvalidAwsExternalId) do
64
+ wf.confirm_aws_external_id(invalid_external_id)
65
+ end
66
+
67
+ assert_raises(ArgumentError) { wf.confirm_aws_external_id }
68
+ end
69
+
40
70
  private
41
71
 
42
72
  def id
@@ -62,4 +92,12 @@ class WavefrontCloudIntegrationTest < WavefrontTestBase
62
92
  def api_class
63
93
  'cloudintegration'
64
94
  end
95
+
96
+ def external_id
97
+ 'HqOM4mru5svd3uFp'
98
+ end
99
+
100
+ def invalid_external_id
101
+ '__nonsense__'
102
+ end
65
103
  end
@@ -411,4 +411,10 @@ class WavefrontValidatorsTest < MiniTest::Test
411
411
  bad = %w[fa312fb-5ff4-420d-862d-5d6d99ed6bcf thing 123]
412
412
  good_and_bad('wf_role_id?', 'InvalidRoleId', good, bad)
413
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
414
420
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |gem|
29
29
 
30
30
  gem.add_development_dependency 'minitest', '~> 5.11'
31
31
  gem.add_development_dependency 'rake', '~> 13.0'
32
- gem.add_development_dependency 'rubocop', '~> 0.87'
32
+ gem.add_development_dependency 'rubocop', '= 0.87.1'
33
33
  gem.add_development_dependency 'simplecov', '~> 0.16'
34
34
  gem.add_development_dependency 'spy', '~> 1.0.0'
35
35
  gem.add_development_dependency 'webmock', '~> 3.7'
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.0.1
4
+ version: 5.1.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: 2020-07-08 00:00:00.000000000 Z
11
+ date: 2020-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: rubocop
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: '0.87'
103
+ version: 0.87.1
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: '0.87'
110
+ version: 0.87.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -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
- rubyforge_project:
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