oneview-sdk 5.5.0 → 5.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -1
- data/README.md +5 -0
- data/endpoints-support.md +11 -11
- data/lib/oneview-sdk/cli.rb +79 -21
- data/lib/oneview-sdk/resource/api200/alerts.rb +39 -0
- data/lib/oneview-sdk/resource/api300/c7000/alerts.rb +22 -0
- data/lib/oneview-sdk/resource/api300/synergy/alerts.rb +22 -0
- data/lib/oneview-sdk/resource/api500/c7000/alerts.rb +22 -0
- data/lib/oneview-sdk/resource/api500/synergy/alerts.rb +22 -0
- data/lib/oneview-sdk/resource/api600/c7000/alerts.rb +22 -0
- data/lib/oneview-sdk/resource/api600/c7000/enclosure.rb +1 -1
- data/lib/oneview-sdk/resource/api600/c7000/scope.rb +39 -28
- data/lib/oneview-sdk/resource/api600/c7000/server_profile.rb +32 -0
- data/lib/oneview-sdk/resource/api600/synergy/alerts.rb +22 -0
- data/lib/oneview-sdk/resource/api600/synergy/enclosure.rb +1 -1
- data/lib/oneview-sdk/resource/api600/synergy/interconnect.rb +15 -0
- data/lib/oneview-sdk/version.rb +1 -1
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89a7a5cef6278ff47b14edb0528fcd85385ec26d
|
4
|
+
data.tar.gz: f2dde091e8be1f8c0c240ebcce1c26ff7165e74d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac0a41f7b1ef587d2c7ab787bd799f9dee42beaaf5337d6af1f1fe3fc99b7a39c22eba5cf64c889ca5f5fe4624e4c1abba6518313e1b5fe83e35f8fdbff1ce24
|
7
|
+
data.tar.gz: bd1df4efd63393891d648c27d18ce4564acc8b84f44e37e9bcf2899ae1dad2b22a5e5c22d3dd4cf7b3dce31fb880a6b04f21336237aa2d51751bed2670b5ff5d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## v5.6.0
|
2
|
+
|
3
|
+
#### Notes
|
4
|
+
This release fixes few bugs which are listed below.
|
5
|
+
|
6
|
+
#### New Resource
|
7
|
+
Alerts
|
8
|
+
|
9
|
+
#### Bug fixes & Enhancements
|
10
|
+
- [#362](https://github.com/HewlettPackard/oneview-sdk-ruby/issues/362) Added helper method to change request body for Server Profile for API600.
|
11
|
+
- [#354](https://github.com/HewlettPackard/oneview-sdk-ruby/issues/354) Input data has be to be a part of body, but not the header for import certificate method in enclosure.
|
12
|
+
- [#356](https://github.com/HewlettPackard/oneview-sdk-ruby/issues/356) Not able to add and remove scopes from a resource in a single API call.
|
13
|
+
- [#359](https://github.com/HewlettPackard/oneview-sdk-ruby/issues/359) Interconnect link topologies endpoints not available for api600. Fixed by inheriting from API500.
|
14
|
+
|
1
15
|
## v5.5.0
|
2
16
|
|
3
17
|
#### Notes
|
@@ -13,7 +27,6 @@ Extended support to Image Streamer Rest API version 500 and 600 to the already e
|
|
13
27
|
- Golden Image
|
14
28
|
- OS Volume
|
15
29
|
|
16
|
-
|
17
30
|
## v5.4.0
|
18
31
|
|
19
32
|
#### Notes
|
@@ -41,6 +54,8 @@ This release adds support to OneView Rest API version 600 for the hardware varia
|
|
41
54
|
- SAS Interconnect Type
|
42
55
|
- SAS Logical Interconnect
|
43
56
|
- SAS Logical Interconnect Group
|
57
|
+
- SAS Logical JBODs
|
58
|
+
- SAS Logical JBOD attachment
|
44
59
|
- Scope
|
45
60
|
- Server Hardware
|
46
61
|
- Server Hardware Types
|
data/README.md
CHANGED
@@ -348,9 +348,12 @@ The CLI does not expose everything in the SDK, but it is great for doing simple
|
|
348
348
|
##### List ServerProfiles:
|
349
349
|
|
350
350
|
```bash
|
351
|
+
# Output a list of ServerProfile names:
|
351
352
|
$ oneview-sdk-ruby list ServerProfiles
|
352
353
|
# Or to show in yaml format (json is also supported):
|
353
354
|
$ oneview-sdk-ruby list ServerProfiles -f yaml
|
355
|
+
# Or to show specific attributes only:
|
356
|
+
$ oneview-sdk-ruby list ServerProfiles -a uri,state,bios.overriddenSettings
|
354
357
|
```
|
355
358
|
|
356
359
|
##### Show details for a specific resource:
|
@@ -369,6 +372,8 @@ $ oneview-sdk-ruby search ServerProfiles --filter state:Normal affinity:Bay
|
|
369
372
|
# but again, you can show only certain attributes by using the -a option
|
370
373
|
# You can also chain keys together to search in nested hashes:
|
371
374
|
$ oneview-sdk-ruby search ServerProfiles --filter state:Normal boot.manageBoot:true
|
375
|
+
# Or to show specific attributes only:
|
376
|
+
$ oneview-sdk-ruby search ServerProfile --filter state:Normal -a name,uri,enclosureBay
|
372
377
|
```
|
373
378
|
|
374
379
|
##### Create or delete resource by file:
|
data/endpoints-support.md
CHANGED
@@ -24,13 +24,13 @@ OneviewSDK::Datacenter.find_by(@client, width: 11000).map(&:remove)
|
|
24
24
|
|
25
25
|
| Endpoints | Verb | V200 | V300 | V500 | V600 |
|
26
26
|
| --------------------------------------------------------------------------------------- | -------- | :------------------: | :------------------: | :------------------: | :------------------: |
|
27
|
-
| **Alerts**
|
28
|
-
|<sub>/rest/alerts
|
29
|
-
|<sub>/rest/alerts
|
30
|
-
|<sub>/rest/alerts/{id}
|
31
|
-
|<sub>/rest/alerts/{id}
|
32
|
-
|<sub>/rest/alerts/{id}
|
33
|
-
|<sub>/rest/alerts/AlertChangeLog/{id}</sub> |DELETE |
|
27
|
+
| **Alerts** |
|
28
|
+
|<sub>/rest/alerts</sub> |GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
29
|
+
|<sub>/rest/alerts</sub> |DELETE | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: |
|
30
|
+
|<sub>/rest/alerts/{id}</sub> |GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
31
|
+
|<sub>/rest/alerts/{id}</sub> |PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
32
|
+
|<sub>/rest/alerts/{id}</sub> |DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
33
|
+
|<sub>/rest/alerts/AlertChangeLog/{id}</sub> |DELETE | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: |
|
34
34
|
| **Appliance Time and Locale Configuration** |
|
35
35
|
|<sub>/rest/appliance/configuration/time-locale</sub> |GET | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: |
|
36
36
|
|<sub>/rest/appliance/configuration/time-locale</sub> |POST | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: |
|
@@ -402,11 +402,11 @@ OneviewSDK::Datacenter.find_by(@client, width: 11000).map(&:remove)
|
|
402
402
|
|<sub>/rest/sas-logical-interconnects/{id}/replaceDriveEnclosure</sub> | POST | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
403
403
|
| **SAS Logical JBOD Attachments** |
|
404
404
|
|<sub>/rest/sas-logical-jbod-attachments</sub> | GET | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
|
405
|
-
|<sub>/rest/sas-logical-jbod-attachments/{id}</sub> | GET | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
|
405
|
+
|<sub>/rest/sas-logical-jbod-attachments/{id}</sub> | GET | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark:
|
406
406
|
| **SAS Logical JBODs** |
|
407
|
-
|<sub>/rest/sas-logical-jbods</sub> | GET | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
|
408
|
-
|<sub>/rest/sas-logical-jbods/{id}</sub> | GET | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
|
409
|
-
|<sub>/rest/sas-logical-jbods/{id}/drives</sub> | GET | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
|
407
|
+
|<sub>/rest/sas-logical-jbods</sub> | GET | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark:
|
408
|
+
|<sub>/rest/sas-logical-jbods/{id}</sub> | GET | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark:
|
409
|
+
|<sub>/rest/sas-logical-jbods/{id}/drives</sub> | GET | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark:
|
410
410
|
| **Scopes** |
|
411
411
|
|<sub>/rest/scopes</sub> | POST | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark:
|
412
412
|
|<sub>/rest/scopes</sub> | GET | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark:
|
data/lib/oneview-sdk/cli.rb
CHANGED
@@ -137,14 +137,26 @@ module OneviewSDK
|
|
137
137
|
aliases: '-f',
|
138
138
|
enum: %w[json yaml human],
|
139
139
|
default: 'human'
|
140
|
-
|
141
|
-
|
140
|
+
method_option :attribute,
|
141
|
+
type: :string,
|
142
|
+
desc: 'Comma-separated list of attributes to show. Supports nesting/chaining with periods',
|
143
|
+
aliases: '-a'
|
144
|
+
list_examples = "\n oneview-sdk-ruby list ServerProfiles"
|
145
|
+
list_examples << "\n oneview-sdk-ruby list ServerHardware -a serialNumber,mpHostInfo.mpHostName"
|
146
|
+
desc 'list TYPE', "List resources. Examples:#{list_examples}"
|
147
|
+
# List names of resources (and optionally, specific attributes)
|
142
148
|
def list(type)
|
143
149
|
resource_class = parse_type(type)
|
144
150
|
client_setup
|
145
|
-
|
146
|
-
|
147
|
-
|
151
|
+
all = resource_class.get_all(@client)
|
152
|
+
if options['attribute']
|
153
|
+
data = select_attributes_from_multiple(options['attribute'], all)
|
154
|
+
output data, -2 # Shift left by 2 so things look right
|
155
|
+
else # List names only by default
|
156
|
+
names = []
|
157
|
+
all.each { |r| names.push(r['name']) }
|
158
|
+
output names
|
159
|
+
end
|
148
160
|
end
|
149
161
|
|
150
162
|
method_option :format,
|
@@ -154,9 +166,12 @@ module OneviewSDK
|
|
154
166
|
default: 'human'
|
155
167
|
method_option :attribute,
|
156
168
|
type: :string,
|
157
|
-
desc: 'Comma-
|
169
|
+
desc: 'Comma-separated list of attributes to show. Supports nesting/chaining with periods',
|
158
170
|
aliases: '-a'
|
159
171
|
desc 'show TYPE NAME', 'Show resource details'
|
172
|
+
show_examples = "\n oneview-sdk-ruby show ServerProfile 'Profile 1'"
|
173
|
+
show_examples << "\n oneview-sdk-ruby show ServerHardware 'Rack1, bay 1' -a serialNumber,mpHostInfo.mpHostName"
|
174
|
+
desc 'show TYPE NAME', "Show resource details. Examples:#{show_examples}"
|
160
175
|
# Show resource details
|
161
176
|
def show(type, name)
|
162
177
|
resource_class = parse_type(type)
|
@@ -165,11 +180,7 @@ module OneviewSDK
|
|
165
180
|
fail_nice 'Not Found' if matches.empty?
|
166
181
|
data = matches.first.data
|
167
182
|
if options['attribute']
|
168
|
-
|
169
|
-
options['attribute'].split(',').each do |attr|
|
170
|
-
new_data[attr] = data[attr]
|
171
|
-
end
|
172
|
-
data = new_data
|
183
|
+
data = select_attributes(options['attribute'], data)
|
173
184
|
end
|
174
185
|
output data
|
175
186
|
end
|
@@ -181,13 +192,16 @@ module OneviewSDK
|
|
181
192
|
default: 'human'
|
182
193
|
method_option :attribute,
|
183
194
|
type: :string,
|
184
|
-
desc: 'Comma-
|
195
|
+
desc: 'Comma-separated list of attributes to show. Supports nesting/chaining with periods',
|
185
196
|
aliases: '-a'
|
186
197
|
method_option :filter,
|
187
198
|
type: :hash,
|
188
199
|
desc: 'Hash of key/value pairs to filter on',
|
189
200
|
required: true
|
190
|
-
|
201
|
+
search_examples = "\n oneview-sdk-ruby search ServerProfiles --filter=status:Critical"
|
202
|
+
search_examples << "\n oneview-sdk-ruby search ServerHardware --filter=state:ProfileApplied -a mpHostInfo.mpHostName"
|
203
|
+
desc 'search TYPE', "Search for resource by key/value pair(s). Examples:#{search_examples}"
|
204
|
+
|
191
205
|
# Search for resource by key/value pair(s)
|
192
206
|
def search(type)
|
193
207
|
resource_class = parse_type(type)
|
@@ -199,14 +213,7 @@ module OneviewSDK
|
|
199
213
|
matches = resource_class.find_by(@client, filter) unless filter == options['filter']
|
200
214
|
end
|
201
215
|
if options['attribute']
|
202
|
-
data = []
|
203
|
-
matches.each do |d|
|
204
|
-
temp = {}
|
205
|
-
options['attribute'].split(',').each do |attr|
|
206
|
-
temp[attr] = d[attr]
|
207
|
-
end
|
208
|
-
data.push(d['name'] => temp)
|
209
|
-
end
|
216
|
+
data = select_attributes_from_multiple(options['attribute'], matches)
|
210
217
|
output data, -2 # Shift left by 2 so things look right
|
211
218
|
else # List names only by default
|
212
219
|
names = []
|
@@ -537,6 +544,57 @@ module OneviewSDK
|
|
537
544
|
new_hash
|
538
545
|
end
|
539
546
|
|
547
|
+
# Select a subset of attributes from a given resource
|
548
|
+
# @param attributes [String, Array<Array<String>>] Comma-separated string or array of array of strings
|
549
|
+
# The reason it's a nested array is to allow retrieval of nested keys.
|
550
|
+
# For example, the following 2 attribute params will return the same result:
|
551
|
+
# - [['key1'], ['key2', 'subKey3']]
|
552
|
+
# - 'key1,key2.subKey3'
|
553
|
+
# @param data [Hash, OneviewSDK::Resource]
|
554
|
+
# @return [Hash] A Hash is returned. For example:
|
555
|
+
# { 'key1' => 'val1', 'key2' => { 'subKey3' => 'val2' } }
|
556
|
+
def select_attributes(attributes, data = {})
|
557
|
+
attributes = attributes.split(',').map(&:strip).reject(&:empty?).map { |a| a.split('.') } if attributes.is_a?(String)
|
558
|
+
r_data = data.is_a?(Hash) ? data : data.data
|
559
|
+
temp = {}
|
560
|
+
attributes.each do |attr|
|
561
|
+
temp_level = temp
|
562
|
+
attr = [attr] if attr.is_a?(String)
|
563
|
+
attr.each_with_index do |a, index|
|
564
|
+
# Safely retrieving and setting nested keys is not as easy, so loop to build a nested Hash structure for the result
|
565
|
+
if index == attr.size - 1
|
566
|
+
# Use r_data.dig(*attr) if we ever drop support for Ruby < 2.3
|
567
|
+
temp_level[a] = [*attr].reduce(r_data) { |m, k| m && m[k] } rescue nil
|
568
|
+
else
|
569
|
+
temp_level[a] ||= {}
|
570
|
+
temp_level = temp_level[a]
|
571
|
+
end
|
572
|
+
end
|
573
|
+
end
|
574
|
+
temp
|
575
|
+
end
|
576
|
+
|
577
|
+
# Select a subset of attributes from a given set of resources
|
578
|
+
# @param attributes [String, Array<Array<String>>] Comma-separated string or array of array of strings
|
579
|
+
# The reason it's a nested array is to allow retrieval of nested keys.
|
580
|
+
# For example, the following 2 attribute params will return the same result:
|
581
|
+
# - [['key1'], ['key2', 'subKey3']]
|
582
|
+
# - 'key1,key2.subKey3'
|
583
|
+
# @param data [Array<Hash>, Array<OneviewSDK::Resource>]
|
584
|
+
# @return [Array<Hash>] An Array of Hashes is returned. For example:
|
585
|
+
# [
|
586
|
+
# { 'resource_name1' => { 'key1' => 'val1', 'key2' => { 'subKey3' => 'val2' } } },
|
587
|
+
# { 'resource_name2' => { 'key1' => 'val3', 'key2' => { 'subKey3' => 'val4' } } },
|
588
|
+
# ]
|
589
|
+
def select_attributes_from_multiple(attributes, data = [])
|
590
|
+
attributes = attributes.split(',').map(&:strip).reject(&:empty?).map { |a| a.split('.') } if attributes.is_a?(String)
|
591
|
+
result = []
|
592
|
+
data.each do |r|
|
593
|
+
result.push(r['name'] => select_attributes(attributes, r))
|
594
|
+
end
|
595
|
+
result
|
596
|
+
end
|
597
|
+
|
540
598
|
# Print output in a given format.
|
541
599
|
def output(data = {}, indent = 0)
|
542
600
|
case @options['format']
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# (C) Copyright 2018 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
|
+
|
12
|
+
require_relative 'resource'
|
13
|
+
|
14
|
+
module OneviewSDK
|
15
|
+
module API200
|
16
|
+
# Event resource implementation
|
17
|
+
class Alerts < Resource
|
18
|
+
BASE_URI = '/rest/alerts'.freeze
|
19
|
+
# Create a resource object, associate it with a client, and set its properties.
|
20
|
+
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
21
|
+
# @param [Hash] params The options for this resource (key-value pairs)
|
22
|
+
# @param [Integer] api_ver The api version to use when interracting with this resource.
|
23
|
+
def initialize(client, params = {}, api_ver = nil)
|
24
|
+
super
|
25
|
+
# Default values:
|
26
|
+
@data['type'] ||= 'AlertResourceV3'
|
27
|
+
end
|
28
|
+
|
29
|
+
def update(attributes = {})
|
30
|
+
set_all(attributes)
|
31
|
+
ensure_client && ensure_uri
|
32
|
+
data = @data.select { |k, _v| %w[alertState alertUrgency assignedToUser notes eTag].include?(k) }
|
33
|
+
response = @client.rest_put(@data['uri'], { 'body' => data }, @api_version)
|
34
|
+
@client.response_handler(response)
|
35
|
+
self
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# (C) Copyright 2018 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
|
+
|
12
|
+
require_relative '../../api200/alerts'
|
13
|
+
|
14
|
+
module OneviewSDK
|
15
|
+
module API300
|
16
|
+
module C7000
|
17
|
+
# Alert resource implementation for API300 C7000
|
18
|
+
class Alerts < OneviewSDK::API200::Alerts
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# (C) Copyright 2018 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
|
+
|
12
|
+
require_relative '../../api200/alerts'
|
13
|
+
|
14
|
+
module OneviewSDK
|
15
|
+
module API300
|
16
|
+
module Synergy
|
17
|
+
# Alerts resource implementation for API300 Synergy
|
18
|
+
class Alerts < OneviewSDK::API200::Alerts
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# (C) Copyright 2018 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
|
+
|
12
|
+
require_relative '../../api300/c7000/alerts'
|
13
|
+
|
14
|
+
module OneviewSDK
|
15
|
+
module API500
|
16
|
+
module C7000
|
17
|
+
# Alerts resource implementation for API500 C7000
|
18
|
+
class Alerts < OneviewSDK::API300::C7000::Alerts
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# (C) Copyright 2018 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
|
+
|
12
|
+
require_relative '../../api300/synergy/alerts'
|
13
|
+
|
14
|
+
module OneviewSDK
|
15
|
+
module API500
|
16
|
+
module Synergy
|
17
|
+
# Alerts resource implementation for API500 Synergy
|
18
|
+
class Alerts < OneviewSDK::API300::Synergy::Alerts
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# (C) Copyright 2018 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
|
+
|
12
|
+
require_relative '../../api500/c7000/alerts'
|
13
|
+
|
14
|
+
module OneviewSDK
|
15
|
+
module API600
|
16
|
+
module C7000
|
17
|
+
# Alerts resource implementation for API600 C7000
|
18
|
+
class Alerts < OneviewSDK::API500::C7000::Alerts
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -62,7 +62,7 @@ module OneviewSDK
|
|
62
62
|
ensure_client && ensure_uri
|
63
63
|
uri = "#{@data['uri']}/https/certificaterequest"
|
64
64
|
uri += "?bayNumber=#{bay_number}" if bay_number
|
65
|
-
response = @client.rest_put(uri, options, @api_version)
|
65
|
+
response = @client.rest_put(uri, { 'body' => options }, @api_version)
|
66
66
|
@client.response_handler(response)
|
67
67
|
end
|
68
68
|
end
|
@@ -30,17 +30,19 @@ module OneviewSDK
|
|
30
30
|
|
31
31
|
# Gets a resource's scope, containing a list of the scopes to which
|
32
32
|
# the resource is assigned.
|
33
|
+
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
33
34
|
# @param [OneviewSDK::API600::C7000::Resource] resource Resource object
|
34
|
-
def get_resource_scopes(resource)
|
35
|
+
def self.get_resource_scopes(client, resource)
|
35
36
|
scopes_uri = resource['scopesUri']
|
36
|
-
response =
|
37
|
-
|
37
|
+
response = client.rest_get(scopes_uri)
|
38
|
+
client.response_handler(response)
|
38
39
|
end
|
39
40
|
|
40
41
|
# Replaces a resource's assigned scopes using the specified list of scope URIs.
|
42
|
+
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
41
43
|
# @param [OneviewSDK::API600::C7000::Resource] resource Resource object
|
42
44
|
# @param [Array<OneviewSDK::API600::C7000::Scope>] scopes Array of scopes objects
|
43
|
-
def replace_resource_assigned_scopes(resource, scopes: [])
|
45
|
+
def self.replace_resource_assigned_scopes(client, resource, scopes: [])
|
44
46
|
resource_uri = resource['uri']
|
45
47
|
scope_uris = scopes.map { |scope| scope['uri'] }
|
46
48
|
scopes_uri = resource['scopesUri']
|
@@ -49,42 +51,51 @@ module OneviewSDK
|
|
49
51
|
'body' => { 'type' => 'ScopedResource',
|
50
52
|
'resourceUri' => resource_uri,
|
51
53
|
'scopeUris' => scope_uris } }
|
52
|
-
response =
|
53
|
-
|
54
|
+
response = client.rest_put(scopes_uri, options)
|
55
|
+
client.response_handler(response)
|
54
56
|
end
|
55
57
|
|
56
58
|
# Performs a specific patch operation.
|
57
|
-
# @param [
|
58
|
-
# @param [
|
59
|
-
# @param [
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
59
|
+
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
60
|
+
# @param [OneviewSDK::API600::C7000::Resource] resource Any resource object
|
61
|
+
# @param [Array<OneviewSDK::API600::C7000::Scope>] scopes Array of scopes objects
|
62
|
+
def self.resource_patch(client, resource, add_scopes: [], remove_scopes: [])
|
63
|
+
scopes_body = []
|
64
|
+
scopes_uri = resource['scopesUri']
|
65
|
+
unless add_scopes.empty?
|
66
|
+
add_scopes.each do |scope|
|
67
|
+
add_body = { 'op' => 'add', 'path' => '/scopeUris/-', 'value' => scope['uri'] }
|
68
|
+
scopes_body.push(add_body)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
unless remove_scopes.empty?
|
72
|
+
remove_scopes.each do |scope|
|
73
|
+
scope_uris = get_resource_scopes(client, resource)['scopeUris']
|
74
|
+
scope_index = scope_uris.find_index { |uri| uri == scope['uri'] }
|
75
|
+
remove_body = { 'op' => 'remove', 'path' => "/scopeUris/#{scope_index}" }
|
76
|
+
scopes_body.push(remove_body)
|
77
|
+
end
|
78
|
+
end
|
66
79
|
options = { 'Content-Type' => 'application/json-patch+json',
|
67
|
-
'If-Match' => '*', 'body' =>
|
68
|
-
response =
|
69
|
-
|
80
|
+
'If-Match' => '*', 'body' => scopes_body }
|
81
|
+
response = client.rest_patch(scopes_uri, options, client.api_version)
|
82
|
+
client.response_handler(response)
|
70
83
|
end
|
71
84
|
|
72
85
|
# Add a scope to resource's scope list
|
86
|
+
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
73
87
|
# @param [OneviewSDK::API600::C7000::Resource] resource Any resource object
|
74
|
-
# @param [
|
75
|
-
def add_resource_scope(resource,
|
76
|
-
|
77
|
-
resource_patch(scopes_uri, 'add', '/scopeUris/-', scope['uri'])
|
88
|
+
# @param [Array] scopes The array of scopes (or any number of scopes separated by comma)
|
89
|
+
def self.add_resource_scope(client, resource, scopes: [])
|
90
|
+
resource_patch(client, resource, add_scopes: scopes)
|
78
91
|
end
|
79
92
|
|
80
93
|
# Remove a scope from resource's scope list.
|
94
|
+
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
81
95
|
# @param [OneviewSDK::API600::C7000::Resource] resource Any resource object
|
82
|
-
# @param [
|
83
|
-
def remove_resource_scope(resource,
|
84
|
-
|
85
|
-
scope_index = scope_uris.find_index { |uri| uri == scope['uri'] }
|
86
|
-
resource_uri = resource['scopesUri']
|
87
|
-
resource_patch(resource_uri, 'remove', "/scopeUris/#{scope_index}", nil)
|
96
|
+
# @param [Array] scopes The array of scopes (or any number of scopes separated by comma)
|
97
|
+
def self.remove_resource_scope(client, resource, scopes: [])
|
98
|
+
resource_patch(client, resource, remove_scopes: scopes)
|
88
99
|
end
|
89
100
|
end
|
90
101
|
end
|
@@ -44,6 +44,38 @@ module OneviewSDK
|
|
44
44
|
def get_messages(*)
|
45
45
|
unavailable_method
|
46
46
|
end
|
47
|
+
|
48
|
+
# Adds a connection entry to server profile
|
49
|
+
# @param [OneviewSDK::EthernetNetwork, OneviewSDK::FCNetwork] network Network associated with the connection
|
50
|
+
# @param [Hash<String,String>] connection_options Hash containing the configuration of the connection
|
51
|
+
# @option connection_options [Boolean] 'boot' Indicates that the server will attempt to boot from this connection.
|
52
|
+
# @option connection_options [String] 'functionType' Type of function required for the connection. Values: Ethernet, FibreChannel, iSCSI.
|
53
|
+
# @option connection_options [Integer] 'id' A unique identifier for this connection. If 0, id is automatically assigned.
|
54
|
+
# @option connection_options [String] 'ipv4' The IP information for a connection. This is only used for iSCSI connections.
|
55
|
+
# @option connection_options [String] 'name' Name of the connection.
|
56
|
+
# @option connection_options [String] 'portId' Identifies the port (FlexNIC) used for this connection.
|
57
|
+
# @option connection_options [String] 'requestedMbps' The transmit throughput (mbps) that should be allocated to this connection.
|
58
|
+
# @option connection_options [String] 'requestedVFs' This value can be "Auto" or 0.
|
59
|
+
def add_connection(network, connection_options = {})
|
60
|
+
connection_options = Hash[connection_options.map { |k, v| [k.to_s, v] }]
|
61
|
+
self['connectionSettings'] = {} unless self['connectionSettings']
|
62
|
+
self['connectionSettings']['connections'] = [] unless self['connectionSettings']['connections']
|
63
|
+
connection_options['id'] ||= 0
|
64
|
+
connection_options['networkUri'] = network['uri'] if network['uri'] || network.retrieve!
|
65
|
+
self['connectionSettings']['connections'] << connection_options
|
66
|
+
end
|
67
|
+
|
68
|
+
# Removes a connection entry in server profile
|
69
|
+
# @param [String] connection_name Name of the connection
|
70
|
+
# @return Returns the connection hash if found, otherwise returns nil
|
71
|
+
def remove_connection(connection_name)
|
72
|
+
desired_connection = nil
|
73
|
+
return desired_connection unless self['connectionSettings']['connections']
|
74
|
+
self['connectionSettings']['connections'].each do |con|
|
75
|
+
desired_connection = self['connectionSettings']['connections'].delete(con) if con['name'] == connection_name
|
76
|
+
end
|
77
|
+
desired_connection
|
78
|
+
end
|
47
79
|
end
|
48
80
|
end
|
49
81
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# (C) Copyright 2018 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
|
+
|
12
|
+
require_relative '../../api500/synergy/alerts'
|
13
|
+
|
14
|
+
module OneviewSDK
|
15
|
+
module API600
|
16
|
+
module Synergy
|
17
|
+
# Alerts resource implementation for API600 Synergy
|
18
|
+
class Alerts < OneviewSDK::API500::Synergy::Alerts
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -62,7 +62,7 @@ module OneviewSDK
|
|
62
62
|
ensure_client && ensure_uri
|
63
63
|
uri = "#{@data['uri']}/https/certificaterequest"
|
64
64
|
uri += "?bayNumber=#{bay_number}" if bay_number
|
65
|
-
response = @client.rest_put(uri, options, @api_version)
|
65
|
+
response = @client.rest_put(uri, { 'body' => options }, @api_version)
|
66
66
|
@client.response_handler(response)
|
67
67
|
end
|
68
68
|
end
|
@@ -17,6 +17,21 @@ module OneviewSDK
|
|
17
17
|
module Synergy
|
18
18
|
# Interconnect resource implementation on API600 Synergy
|
19
19
|
class Interconnect < OneviewSDK::API600::C7000::Interconnect
|
20
|
+
|
21
|
+
# Retrieves the interconnect link topologies
|
22
|
+
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
23
|
+
# @return [Array] All the Interconnect Link Topologies
|
24
|
+
def self.get_link_topologies(client)
|
25
|
+
OneviewSDK::API300::Synergy::Interconnect.get_link_topologies(client)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Retrieves the interconnect link topology with the name
|
29
|
+
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
30
|
+
# @param [String] name Switch type name
|
31
|
+
# @return [Array] Switch type
|
32
|
+
def self.get_link_topology(client, name)
|
33
|
+
OneviewSDK::API300::Synergy::Interconnect.get_link_topology(client, name)
|
34
|
+
end
|
20
35
|
end
|
21
36
|
end
|
22
37
|
end
|
data/lib/oneview-sdk/version.rb
CHANGED
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: 5.
|
4
|
+
version: 5.6.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: 2018-
|
14
|
+
date: 2018-06-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: thor
|
@@ -245,6 +245,7 @@ files:
|
|
245
245
|
- lib/oneview-sdk/image_streamer.rb
|
246
246
|
- lib/oneview-sdk/resource.rb
|
247
247
|
- lib/oneview-sdk/resource/api200.rb
|
248
|
+
- lib/oneview-sdk/resource/api200/alerts.rb
|
248
249
|
- lib/oneview-sdk/resource/api200/client_certificate.rb
|
249
250
|
- lib/oneview-sdk/resource/api200/connection_template.rb
|
250
251
|
- lib/oneview-sdk/resource/api200/datacenter.rb
|
@@ -291,6 +292,7 @@ files:
|
|
291
292
|
- lib/oneview-sdk/resource/api200/web_server_certificate.rb
|
292
293
|
- lib/oneview-sdk/resource/api300.rb
|
293
294
|
- lib/oneview-sdk/resource/api300/c7000.rb
|
295
|
+
- lib/oneview-sdk/resource/api300/c7000/alerts.rb
|
294
296
|
- lib/oneview-sdk/resource/api300/c7000/client_certificate.rb
|
295
297
|
- lib/oneview-sdk/resource/api300/c7000/connection_template.rb
|
296
298
|
- lib/oneview-sdk/resource/api300/c7000/datacenter.rb
|
@@ -338,6 +340,7 @@ files:
|
|
338
340
|
- lib/oneview-sdk/resource/api300/c7000/volume_template.rb
|
339
341
|
- lib/oneview-sdk/resource/api300/c7000/web_server_certificate.rb
|
340
342
|
- lib/oneview-sdk/resource/api300/synergy.rb
|
343
|
+
- lib/oneview-sdk/resource/api300/synergy/alerts.rb
|
341
344
|
- lib/oneview-sdk/resource/api300/synergy/client_certificate.rb
|
342
345
|
- lib/oneview-sdk/resource/api300/synergy/connection_template.rb
|
343
346
|
- lib/oneview-sdk/resource/api300/synergy/datacenter.rb
|
@@ -389,6 +392,7 @@ files:
|
|
389
392
|
- lib/oneview-sdk/resource/api300/synergy/web_server_certificate.rb
|
390
393
|
- lib/oneview-sdk/resource/api500.rb
|
391
394
|
- lib/oneview-sdk/resource/api500/c7000.rb
|
395
|
+
- lib/oneview-sdk/resource/api500/c7000/alerts.rb
|
392
396
|
- lib/oneview-sdk/resource/api500/c7000/client_certificate.rb
|
393
397
|
- lib/oneview-sdk/resource/api500/c7000/connection_template.rb
|
394
398
|
- lib/oneview-sdk/resource/api500/c7000/datacenter.rb
|
@@ -436,6 +440,7 @@ files:
|
|
436
440
|
- lib/oneview-sdk/resource/api500/c7000/volume_template.rb
|
437
441
|
- lib/oneview-sdk/resource/api500/c7000/web_server_certificate.rb
|
438
442
|
- lib/oneview-sdk/resource/api500/synergy.rb
|
443
|
+
- lib/oneview-sdk/resource/api500/synergy/alerts.rb
|
439
444
|
- lib/oneview-sdk/resource/api500/synergy/client_certificate.rb
|
440
445
|
- lib/oneview-sdk/resource/api500/synergy/connection_template.rb
|
441
446
|
- lib/oneview-sdk/resource/api500/synergy/datacenter.rb
|
@@ -487,6 +492,7 @@ files:
|
|
487
492
|
- lib/oneview-sdk/resource/api500/synergy/web_server_certificate.rb
|
488
493
|
- lib/oneview-sdk/resource/api600.rb
|
489
494
|
- lib/oneview-sdk/resource/api600/c7000.rb
|
495
|
+
- lib/oneview-sdk/resource/api600/c7000/alerts.rb
|
490
496
|
- lib/oneview-sdk/resource/api600/c7000/client_certificate.rb
|
491
497
|
- lib/oneview-sdk/resource/api600/c7000/connection_template.rb
|
492
498
|
- lib/oneview-sdk/resource/api600/c7000/datacenter.rb
|
@@ -534,6 +540,7 @@ files:
|
|
534
540
|
- lib/oneview-sdk/resource/api600/c7000/volume_template.rb
|
535
541
|
- lib/oneview-sdk/resource/api600/c7000/web_server_certificate.rb
|
536
542
|
- lib/oneview-sdk/resource/api600/synergy.rb
|
543
|
+
- lib/oneview-sdk/resource/api600/synergy/alerts.rb
|
537
544
|
- lib/oneview-sdk/resource/api600/synergy/client_certificate.rb
|
538
545
|
- lib/oneview-sdk/resource/api600/synergy/connection_template.rb
|
539
546
|
- lib/oneview-sdk/resource/api600/synergy/datacenter.rb
|
@@ -609,7 +616,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
609
616
|
version: '0'
|
610
617
|
requirements: []
|
611
618
|
rubyforge_project:
|
612
|
-
rubygems_version: 2.6.
|
619
|
+
rubygems_version: 2.6.11
|
613
620
|
signing_key:
|
614
621
|
specification_version: 4
|
615
622
|
summary: Gem to interact with the HPE OneView API
|