radfish 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/radfish/client.rb +24 -12
- data/lib/radfish/controller.rb +28 -3
- data/lib/radfish/core/storage.rb +1 -0
- data/lib/radfish/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73011007c472b46cd1b41258548fdc37da25f15a4d14c370809aeafe5d67953b
|
4
|
+
data.tar.gz: 0b649b8aa1b6c5d05eae02641b2fef7fc6bb9d45b913fdd7727c875c69c62562
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65195d4125e3afb35707adc1b87d1370de1df0b2e19afe6a5a7e56a0ace94a8437b83f9c70d1d6ada0861074d7dede5d3ccb06c5861e1e20aec95388d79ae763
|
7
|
+
data.tar.gz: c99fcf649bb95dd02a861457920c310f276ec544f86fa3016771953dd277ac8a9c996add49207c59fa7f200384db570ae2b45d64abe2612663145e5b13085b98
|
data/lib/radfish/client.rb
CHANGED
@@ -188,18 +188,30 @@ module Radfish
|
|
188
188
|
private
|
189
189
|
|
190
190
|
def build_controller(raw)
|
191
|
-
#
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
191
|
+
# Expect adapters to provide normalized fields; keep mapping straightforward.
|
192
|
+
fetch = ->(key) do
|
193
|
+
if raw.respond_to?(:[])
|
194
|
+
raw[key.to_s] || raw[key.to_sym]
|
195
|
+
elsif raw.respond_to?(key.to_sym)
|
196
|
+
raw.public_send(key.to_sym)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
Controller.new(
|
201
|
+
client: self,
|
202
|
+
id: fetch.call(:id),
|
203
|
+
name: fetch.call(:name),
|
204
|
+
model: fetch.call(:model),
|
205
|
+
firmware_version: fetch.call(:firmware_version),
|
206
|
+
encryption_mode: fetch.call(:encryption_mode),
|
207
|
+
encryption_capability: fetch.call(:encryption_capability),
|
208
|
+
controller_type: fetch.call(:controller_type),
|
209
|
+
pci_slot: fetch.call(:pci_slot),
|
210
|
+
status: fetch.call(:status),
|
211
|
+
drives_count: fetch.call(:drives_count),
|
212
|
+
vendor: @vendor,
|
213
|
+
adapter_data: raw
|
214
|
+
)
|
203
215
|
end
|
204
216
|
end
|
205
217
|
end
|
data/lib/radfish/controller.rb
CHANGED
@@ -4,14 +4,26 @@ module Radfish
|
|
4
4
|
# Lightweight value object representing a storage controller.
|
5
5
|
# Holds a stable identifier and optional name.
|
6
6
|
class Controller
|
7
|
-
attr_reader :id, :name, :vendor, :adapter_data
|
7
|
+
attr_reader :id, :name, :model, :vendor, :adapter_data, :firmware_version,
|
8
|
+
:encryption_mode, :encryption_capability, :controller_type,
|
9
|
+
:pci_slot, :status, :drives_count
|
8
10
|
|
9
|
-
def initialize(client:, id:, name: nil, vendor: nil, adapter_data: nil
|
11
|
+
def initialize(client:, id:, name: nil, model: nil, vendor: nil, adapter_data: nil,
|
12
|
+
firmware_version: nil, encryption_mode: nil, encryption_capability: nil,
|
13
|
+
controller_type: nil, pci_slot: nil, status: nil, drives_count: nil)
|
10
14
|
@client = client
|
11
15
|
@id = id
|
12
16
|
@name = name
|
17
|
+
@model = model
|
13
18
|
@vendor = vendor
|
14
19
|
@adapter_data = adapter_data
|
20
|
+
@firmware_version = firmware_version
|
21
|
+
@encryption_mode = encryption_mode
|
22
|
+
@encryption_capability = encryption_capability
|
23
|
+
@controller_type = controller_type
|
24
|
+
@pci_slot = pci_slot
|
25
|
+
@status = status
|
26
|
+
@drives_count = drives_count
|
15
27
|
end
|
16
28
|
|
17
29
|
# Convenience accessors delegate to the client wrappers
|
@@ -24,11 +36,24 @@ module Radfish
|
|
24
36
|
end
|
25
37
|
|
26
38
|
def to_h
|
27
|
-
{
|
39
|
+
{
|
40
|
+
id: id,
|
41
|
+
name: name,
|
42
|
+
model: model,
|
43
|
+
vendor: vendor,
|
44
|
+
firmware_version: firmware_version,
|
45
|
+
encryption_mode: encryption_mode,
|
46
|
+
encryption_capability: encryption_capability,
|
47
|
+
controller_type: controller_type,
|
48
|
+
pci_slot: pci_slot,
|
49
|
+
status: status,
|
50
|
+
drives_count: drives_count
|
51
|
+
}.compact
|
28
52
|
end
|
29
53
|
|
30
54
|
def ==(other)
|
31
55
|
other.is_a?(Controller) && other.id == id && other.vendor.to_s == vendor.to_s
|
32
56
|
end
|
57
|
+
|
33
58
|
end
|
34
59
|
end
|
data/lib/radfish/core/storage.rb
CHANGED
data/lib/radfish/version.rb
CHANGED