oneview-sdk 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -0
  3. data/CHANGELOG.md +81 -2
  4. data/README.md +118 -113
  5. data/Rakefile +11 -0
  6. data/lib/oneview-sdk/cli.rb +21 -15
  7. data/lib/oneview-sdk/client.rb +34 -21
  8. data/lib/oneview-sdk/config_loader.rb +12 -1
  9. data/lib/oneview-sdk/exceptions.rb +55 -0
  10. data/lib/oneview-sdk/resource/connection_template.rb +48 -0
  11. data/lib/oneview-sdk/resource/datacenter.rb +77 -0
  12. data/lib/oneview-sdk/resource/enclosure.rb +46 -24
  13. data/lib/oneview-sdk/resource/enclosure_group.rb +20 -36
  14. data/lib/oneview-sdk/resource/ethernet_network.rb +19 -23
  15. data/lib/oneview-sdk/resource/fabric.rb +41 -0
  16. data/lib/oneview-sdk/resource/fc_network.rb +15 -16
  17. data/lib/oneview-sdk/resource/fcoe_network.rb +15 -12
  18. data/lib/oneview-sdk/resource/firmware_bundle.rb +23 -24
  19. data/lib/oneview-sdk/resource/firmware_driver.rb +21 -9
  20. data/lib/oneview-sdk/resource/interconnect.rb +29 -9
  21. data/lib/oneview-sdk/resource/lig_uplink_set.rb +22 -28
  22. data/lib/oneview-sdk/resource/logical_downlink.rb +53 -0
  23. data/lib/oneview-sdk/resource/logical_enclosure.rb +35 -33
  24. data/lib/oneview-sdk/resource/logical_interconnect.rb +29 -65
  25. data/lib/oneview-sdk/resource/logical_interconnect_group.rb +26 -6
  26. data/lib/oneview-sdk/resource/logical_switch.rb +184 -0
  27. data/lib/oneview-sdk/resource/logical_switch_group.rb +66 -0
  28. data/lib/oneview-sdk/resource/managed_san.rb +79 -0
  29. data/lib/oneview-sdk/resource/network_set.rb +64 -0
  30. data/lib/oneview-sdk/resource/power_device.rb +174 -0
  31. data/lib/oneview-sdk/resource/rack.rb +83 -0
  32. data/lib/oneview-sdk/resource/san_manager.rb +88 -0
  33. data/lib/oneview-sdk/resource/server_hardware.rb +139 -18
  34. data/lib/oneview-sdk/resource/server_hardware_type.rb +32 -1
  35. data/lib/oneview-sdk/resource/server_profile.rb +352 -9
  36. data/lib/oneview-sdk/resource/server_profile_template.rb +193 -4
  37. data/lib/oneview-sdk/resource/storage_pool.rb +42 -20
  38. data/lib/oneview-sdk/resource/storage_system.rb +64 -14
  39. data/lib/oneview-sdk/resource/switch.rb +86 -0
  40. data/lib/oneview-sdk/resource/unmanaged_device.rb +55 -0
  41. data/lib/oneview-sdk/resource/uplink_set.rb +24 -64
  42. data/lib/oneview-sdk/resource/volume.rb +29 -29
  43. data/lib/oneview-sdk/resource/volume_attachment.rb +79 -0
  44. data/lib/oneview-sdk/resource/volume_snapshot.rb +20 -1
  45. data/lib/oneview-sdk/resource/volume_template.rb +22 -33
  46. data/lib/oneview-sdk/resource.rb +66 -28
  47. data/lib/oneview-sdk/rest.rb +69 -24
  48. data/lib/oneview-sdk/ssl_helper.rb +20 -9
  49. data/lib/oneview-sdk/version.rb +12 -1
  50. data/lib/oneview-sdk.rb +12 -0
  51. data/oneview-sdk.gemspec +11 -0
  52. metadata +17 -2
@@ -1,9 +1,20 @@
1
+ # (C) Copyright 2016 Hewlett Packard Enterprise Development LP
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # You may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software distributed
8
+ # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9
+ # CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
10
+ # language governing permissions and limitations under the License.
11
+
1
12
  require 'uri'
2
13
  require 'net/http'
3
14
  require 'openssl'
4
15
 
5
16
  module OneviewSDK
6
- # SSL Certificate helper
17
+ # SSL certificate helper
7
18
  module SSLHelper
8
19
  CERT_STORE = File.join(Dir.home, '/.oneview-sdk-ruby/trusted_certs.cer')
9
20
 
@@ -25,13 +36,13 @@ module OneviewSDK
25
36
  nil
26
37
  end
27
38
 
28
- # Check to see if a OneView instance's certificate is trusted
29
- # @param [String] url URL of the OneView Instance to be added
39
+ # Check to see if the OneView instance's certificate is trusted
40
+ # @param [String] url URL for the OneView Instance to be added
30
41
  # @return [Boolean] Whether or not certificate is trusted
31
- # @raise [RuntimeError] if the url is invalid
42
+ # @raise [OneviewSDK::InvalidURL] if the url is invalid
32
43
  def self.check_cert(url)
33
44
  uri = URI.parse(URI.escape(url))
34
- fail "Invalid url '#{url}'" unless uri.host
45
+ fail InvalidURL, "Invalid url '#{url}'" unless uri.host
35
46
  http = Net::HTTP.new(uri.host, uri.port)
36
47
  http.use_ssl = true if uri.scheme == 'https'
37
48
  trusted_certs = load_trusted_certs
@@ -42,13 +53,13 @@ module OneviewSDK
42
53
  false
43
54
  end
44
55
 
45
- # Fetch and add the ssl certificate of a OneView instance to the trusted certs store.
56
+ # Fetch and add the SSL certificate for the OneView instance to the trusted certs store.
46
57
  # Creates/modifies file at ~/.oneview-sdk-ruby/trusted_certs.cer
47
- # @param [String] url URL of the OneView Instance to be added
48
- # @raise [RuntimeError] if the url is invalid
58
+ # @param [String] url URL for the OneView Instance to be added
59
+ # @raise [OneviewSDK::InvalidURL] if the url is invalid
49
60
  def self.install_cert(url)
50
61
  uri = URI.parse(URI.escape(url))
51
- fail "Invalid url '#{url}'" unless uri.host
62
+ fail InvalidURL, "Invalid url '#{url}'" unless uri.host
52
63
  options = { use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE }
53
64
  pem = Net::HTTP.start(uri.host, uri.port, options) do |http|
54
65
  http.peer_cert.to_pem
@@ -1,4 +1,15 @@
1
+ # (C) Copyright 2016 Hewlett Packard Enterprise Development LP
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # You may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software distributed
8
+ # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9
+ # CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
10
+ # language governing permissions and limitations under the License.
11
+
1
12
  # Gem version defined here
2
13
  module OneviewSDK
3
- VERSION = '1.0.0'.freeze
14
+ VERSION = '2.0.0'.freeze
4
15
  end
data/lib/oneview-sdk.rb CHANGED
@@ -1,4 +1,16 @@
1
+ # (C) Copyright 2016 Hewlett Packard Enterprise Development LP
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # You may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software distributed
8
+ # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9
+ # CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
10
+ # language governing permissions and limitations under the License.
11
+
1
12
  require_relative 'oneview-sdk/version'
13
+ require_relative 'oneview-sdk/exceptions'
2
14
  require_relative 'oneview-sdk/client'
3
15
  require_relative 'oneview-sdk/resource'
4
16
  require_relative 'oneview-sdk/cli'
data/oneview-sdk.gemspec CHANGED
@@ -1,6 +1,17 @@
1
1
  # coding: utf-8
2
2
  # http://guides.rubygems.org/specification-reference
3
3
 
4
+ # (C) Copyright 2016 Hewlett Packard Enterprise Development LP
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # You may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software distributed
11
+ # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12
+ # CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
13
+ # language governing permissions and limitations under the License.
14
+
4
15
  require_relative './lib/oneview-sdk/version'
5
16
 
6
17
  Gem::Specification.new do |spec|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oneview-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrique Diomede
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-04-29 00:00:00.000000000 Z
14
+ date: 2016-07-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: thor
@@ -150,27 +150,42 @@ files:
150
150
  - lib/oneview-sdk/cli.rb
151
151
  - lib/oneview-sdk/client.rb
152
152
  - lib/oneview-sdk/config_loader.rb
153
+ - lib/oneview-sdk/exceptions.rb
153
154
  - lib/oneview-sdk/resource.rb
155
+ - lib/oneview-sdk/resource/connection_template.rb
156
+ - lib/oneview-sdk/resource/datacenter.rb
154
157
  - lib/oneview-sdk/resource/enclosure.rb
155
158
  - lib/oneview-sdk/resource/enclosure_group.rb
156
159
  - lib/oneview-sdk/resource/ethernet_network.rb
160
+ - lib/oneview-sdk/resource/fabric.rb
157
161
  - lib/oneview-sdk/resource/fc_network.rb
158
162
  - lib/oneview-sdk/resource/fcoe_network.rb
159
163
  - lib/oneview-sdk/resource/firmware_bundle.rb
160
164
  - lib/oneview-sdk/resource/firmware_driver.rb
161
165
  - lib/oneview-sdk/resource/interconnect.rb
162
166
  - lib/oneview-sdk/resource/lig_uplink_set.rb
167
+ - lib/oneview-sdk/resource/logical_downlink.rb
163
168
  - lib/oneview-sdk/resource/logical_enclosure.rb
164
169
  - lib/oneview-sdk/resource/logical_interconnect.rb
165
170
  - lib/oneview-sdk/resource/logical_interconnect_group.rb
171
+ - lib/oneview-sdk/resource/logical_switch.rb
172
+ - lib/oneview-sdk/resource/logical_switch_group.rb
173
+ - lib/oneview-sdk/resource/managed_san.rb
174
+ - lib/oneview-sdk/resource/network_set.rb
175
+ - lib/oneview-sdk/resource/power_device.rb
176
+ - lib/oneview-sdk/resource/rack.rb
177
+ - lib/oneview-sdk/resource/san_manager.rb
166
178
  - lib/oneview-sdk/resource/server_hardware.rb
167
179
  - lib/oneview-sdk/resource/server_hardware_type.rb
168
180
  - lib/oneview-sdk/resource/server_profile.rb
169
181
  - lib/oneview-sdk/resource/server_profile_template.rb
170
182
  - lib/oneview-sdk/resource/storage_pool.rb
171
183
  - lib/oneview-sdk/resource/storage_system.rb
184
+ - lib/oneview-sdk/resource/switch.rb
185
+ - lib/oneview-sdk/resource/unmanaged_device.rb
172
186
  - lib/oneview-sdk/resource/uplink_set.rb
173
187
  - lib/oneview-sdk/resource/volume.rb
188
+ - lib/oneview-sdk/resource/volume_attachment.rb
174
189
  - lib/oneview-sdk/resource/volume_snapshot.rb
175
190
  - lib/oneview-sdk/resource/volume_template.rb
176
191
  - lib/oneview-sdk/rest.rb