xclarity_client 0.3.1 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/docs/apib/event.apib +36 -0
- data/docs/apib/node.apib +14 -0
- data/lib/xclarity_client.rb +3 -1
- data/lib/xclarity_client/client.rb +104 -21
- data/lib/xclarity_client/configuration.rb +0 -1
- data/lib/xclarity_client/event.rb +20 -0
- data/lib/xclarity_client/event_management.rb +17 -0
- data/lib/xclarity_client/node_management.rb +17 -1
- data/lib/xclarity_client/version.rb +1 -1
- data/lib/xclarity_client/xclarity_base.rb +8 -0
- data/lib/xclarity_client/xclarity_management_mixin.rb +33 -4
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c41d0e0311636c2489fb235c85afada88e6b866b
|
4
|
+
data.tar.gz: 030b0aaf7c1df57889a4fe720eb34b6717ecdc4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb641bc7a7d1a8daaccae075b09dbc494b0a6522dcbd134113f30d09e499c4f1d601fea9507cda900fe53ad243bd5f8b36b5ba23ef3b76a086727700cc57f64f
|
7
|
+
data.tar.gz: 8c047ae42ff2b663f228c046a49bfcd4891e14091dc8a5517fe7730525d1032173103ebdbc2dba2775a672324392cca2eee380804ba164966947014c3c8f79ba
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# XClarity Client
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/
|
3
|
+
[![Build Status](https://travis-ci.org/lenovo/xclarity_client.svg)](https://travis-ci.org/lenovo/xclarity_client)
|
4
4
|
|
5
5
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/xclarity_client`. To experiment with that code, run `bin/console` for an interactive prompt.
|
6
6
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
FORMAT: 1A
|
2
|
+
|
3
|
+
# Events
|
4
|
+
|
5
|
+
# GET /events
|
6
|
+
|
7
|
+
+ Response 200 (application/json)
|
8
|
+
[ { "eventDate": "2016-12-21T17:13:58Z", "systemTypeText": "Management", "chassisText": "Not Available", "timeStamp": "2016-12-21T17:13:58Z", "location": "", "args": [ "EAAC33576492E511B46A70E28412CA06" ], "originatorUUID": "", "systemName": "Management Server", "bayText": "Not Available", "mtm": "", "userid": "", "fruSerialNumberText": "Not Available", "eventSourceText": "Management", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "flags": "", "userIDIndex": 0, "failSNs": "", "severityText": "Warning", "severity": 300, "serviceabilityText": "User", "failFRUs": "", "msg": "Endpoint EAAC33576492E511B46A70E28412CA06 could not be accessed because credentials were refused.", "componentID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "eventClass": 800, "eventID": "FQXHMTS0009G", "sourceLogSequence": 0, "systemSerialNumberText": "Not Available", "cn": "242679", "service": 300, "typeText": "System", "msgID": "", "systemFruNumberText": "Not Available", "systemText": "Management Server" }, { "eventDate": "2016-12-21T17:13:58Z", "systemTypeText": "Management", "chassisText": "Not Available", "timeStamp": "2016-12-21T17:13:58Z", "location": "", "args": [ "EAAC33576492E511B46A70E28412CA06", "03.76.208", "TB5TS381" ], "originatorUUID": "", "systemName": "Management Server", "bayText": "Not Available", "mtm": "", "userid": "", "fruSerialNumberText": "Not Available", "eventSourceText": "Management", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "flags": "", "userIDIndex": 0, "failSNs": "", "severityText": "Warning", "severity": 300, "serviceabilityText": "User", "failFRUs": "", "msg": "Inventory data could not be retrieved from the endpoint EAAC33576492E511B46A70E28412CA06. BIOS: 03.76.208, BMC: TB5TS381", "componentID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "eventClass": 800, "eventID": "FQXHMTS0003G", "sourceLogSequence": 0, "systemSerialNumberText": "Not Available", "cn": "242678", "service": 300, "typeText": "System", "msgID": "", "systemFruNumberText": "Not Available", "systemText": "Management Server" }, { "eventDate": "2016-12-21T17:13:58Z", "systemTypeText": "Management", "chassisText": "Not Available", "timeStamp": "2016-12-21T17:13:58Z", "location": "", "args": [ "EAAC33576492E511B46A70E28412CA06" ], "originatorUUID": "", "systemName": "Management Server", "bayText": "Not Available", "mtm": "", "userid": "", "fruSerialNumberText": "Not Available", "eventSourceText": "Management", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "flags": "", "userIDIndex": 0, "failSNs": "", "severityText": "Warning", "severity": 300, "serviceabilityText": "User", "failFRUs": "", "msg": "Endpoint EAAC33576492E511B46A70E28412CA06 could not be accessed because credentials were refused.", "componentID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "eventClass": 800, "eventID": "FQXHMTS0009G", "sourceLogSequence": 0, "systemSerialNumberText": "Not Available", "cn": "242677", "service": 300, "typeText": "System", "msgID": "", "systemFruNumberText": "Not Available", "systemText": "Management Server" } ]
|
9
|
+
|
10
|
+
+ Response 400
|
11
|
+
+ Response 401
|
12
|
+
+ Response 404
|
13
|
+
+ Response 409
|
14
|
+
+ Response 500
|
15
|
+
|
16
|
+
# GET /events?filterWith=%257B%2522filterType%2522%3A%2522FIELDNOTREGEXAND%2522%2C%2522fields%2522%3A%5B%257B%2522operation%2522%3A%2522GT%2522%2C%2522field%2522%3A%2522cn%2522%2C%2522value%2522%3A%2522242328%2522%257D%5D%257D
|
17
|
+
|
18
|
+
+ Response 200 (application/json)
|
19
|
+
[ { "eventDate": "2016-12-21T16:01:58Z","systemTypeText":"Management","chassisText":"Not Available","timeStamp":"2016-12-21T16:01:58Z", "location": "", "args": [ "EAAC33576492E511B46A70E28412CA06" ], "originatorUUID": "", "systemName": "Management Server", "bayText": "Not Available", "mtm": "", "userid": "", "fruSerialNumberText": "Not Available", "eventSourceText": "Management", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "flags": "", "userIDIndex": 0, "failSNs": "", "severityText": "Warning", "severity": 300, "serviceabilityText": "User", "failFRUs": "", "msg": "Endpoint EAAC33576492E511B46A70E28412CA06 could not be accessed because credentials were refused.", "componentID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "eventClass": 800, "eventID": "FQXHMTS0009G", "sourceLogSequence": 0, "systemSerialNumberText": "Not Available", "cn": "242331", "service": 300, "typeText": "System", "msgID": "", "systemFruNumberText": "Not Available", "systemText": "Management Server" }, { "eventDate": "2016-12-21T16:01:58Z", "systemTypeText": "Management", "chassisText": "Not Available", "timeStamp": "2016-12-21T16:01:58Z", "location": "", "args": [ "EAAC33576492E511B46A70E28412CA06", "03.76.208", "TB5TS381" ], "originatorUUID": "", "systemName": "Management Server", "bayText": "Not Available", "mtm": "", "userid": "", "fruSerialNumberText": "Not Available", "eventSourceText": "Management", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "flags": "", "userIDIndex": 0, "failSNs": "", "severityText": "Warning", "severity": 300, "serviceabilityText": "User", "failFRUs": "", "msg": "Inventory data could not be retrieved from the endpoint EAAC33576492E511B46A70E28412CA06. BIOS: 03.76.208, BMC: TB5TS381", "componentID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "eventClass": 800, "eventID": "FQXHMTS0003G", "sourceLogSequence": 0, "systemSerialNumberText": "Not Available", "cn": "242330", "service": 300, "typeText": "System", "msgID": "", "systemFruNumberText": "Not Available", "systemText": "Management Server" }, { "eventDate": "2016-12-21T16:01:58Z", "systemTypeText": "Management", "chassisText": "Not Available", "timeStamp": "2016-12-21T16:01:58Z", "location": "", "args": [ "EAAC33576492E511B46A70E28412CA06" ], "originatorUUID": "", "systemName": "Management Server", "bayText": "Not Available", "mtm": "", "userid": "", "fruSerialNumberText": "Not Available", "eventSourceText": "Management", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "flags": "", "userIDIndex": 0, "failSNs": "", "severityText": "Warning", "severity": 300, "serviceabilityText": "User", "failFRUs": "", "msg": "Endpoint EAAC33576492E511B46A70E28412CA06 could not be accessed because credentials were refused.", "componentID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "eventClass": 800, "eventID": "FQXHMTS0009G", "sourceLogSequence": 0, "systemSerialNumberText": "Not Available", "cn": "242329", "service": 300, "typeText": "System", "msgID": "", "systemFruNumberText": "Not Available", "systemText": "Management Server" } ]
|
20
|
+
|
21
|
+
+ Response 400
|
22
|
+
+ Response 401
|
23
|
+
+ Response 404
|
24
|
+
+ Response 409
|
25
|
+
+ Response 500
|
26
|
+
|
27
|
+
# GET /events?sort=cn
|
28
|
+
|
29
|
+
+ Response 200 (application/json)
|
30
|
+
[ { "eventDate": "2016-10-19T20:41:40Z", "systemTypeText": "Management", "chassisText": "Not Available", "timeStamp": "2016-10-19T20:41:41Z", "location": "", "args": [ "10.243.12.93", "SYSMGR_7QXUWSTC" ], "originatorUUID": "", "systemName": "Management Server", "bayText": "Not Available", "mtm": "", "userid": "", "fruSerialNumberText": "Not Available", "eventSourceText": "Management", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "flags": "", "userIDIndex": 1, "failSNs": "", "severityText": "Informational", "severity": 200, "serviceabilityText": "Not Required", "failFRUs": "", "msg": "Management Server 10.243.12.93 started by SYSMGR_7QXUWSTC.", "componentID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "eventClass": 800, "eventID": "FQXHMNM0125I", "sourceLogSequence": 0, "systemSerialNumberText": "Not Available", "cn": "5", "service": 100, "typeText": "System", "msgID": "", "systemFruNumberText": "Not Available", "systemText": "Management Server" }, { "eventDate": "2016-10-19T20:49:23Z", "systemTypeText": "Management", "chassisText": "Not Available", "timeStamp": "2016-10-19T20:49:25Z", "location": "", "args": [ "10.243.13.246", "SYSMGR_CAJFSKVT" ], "originatorUUID": "", "systemName": "Management Server", "bayText": "Not Available", "mtm": "", "userid": "", "fruSerialNumberText": "Not Available", "eventSourceText": "Management", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "flags": "", "userIDIndex": 1, "failSNs": "", "severityText": "Informational", "severity": 200, "serviceabilityText": "Not Required", "failFRUs": "", "msg": "Management Server 10.243.13.246 started by SYSMGR_CAJFSKVT.", "componentID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "eventClass": 800, "eventID": "FQXHMNM0125I", "sourceLogSequence": 0, "systemSerialNumberText": "Not Available", "cn": "16", "service": 100, "typeText": "System", "msgID": "", "systemFruNumberText": "Not Available", "systemText": "Management Server" }, { "eventDate": "2016-11-10T10:05:01Z", "systemTypeText": "Management", "chassisText": "Not Available", "timeStamp": "2016-11-10T10:05:01Z", "location": "", "args": [ "server", "RD650", "8270A9889761E51181793C18A001A220" ], "originatorUUID": "", "systemName": "Management Server", "bayText": "Not Available", "mtm": "", "userid": "", "fruSerialNumberText": "Not Available", "eventSourceText": "Management", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "flags": "", "userIDIndex": 0, "failSNs": "", "severityText": "Informational", "severity": 200, "serviceabilityText": "Not Required", "failFRUs": "", "msg": "Connectivity to server RD650 has been lost. UUID is 8270A9889761E51181793C18A001A220.", "componentID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "eventClass": 800, "eventID": "FQXHMDM0003I", "sourceLogSequence": 0, "systemSerialNumberText": "Not Available", "cn": "74", "service": 100, "typeText": "System", "msgID": "", "systemFruNumberText": "Not Available", "systemText": "Management Server" } ]
|
31
|
+
|
32
|
+
+ Response 400
|
33
|
+
+ Response 401
|
34
|
+
+ Response 404
|
35
|
+
+ Response 409
|
36
|
+
+ Response 500
|
data/docs/apib/node.apib
CHANGED
@@ -9008,3 +9008,17 @@ FORMAT: 1A
|
|
9008
9008
|
+ Response 404
|
9009
9009
|
+ Response 409
|
9010
9010
|
+ Response 500
|
9011
|
+
|
9012
|
+
# PUT /nodes/6B538D351B8211E193F65CF3FC6E4030
|
9013
|
+
|
9014
|
+
+ Response 200 (application/json)
|
9015
|
+
|
9016
|
+
+Headers
|
9017
|
+
|
9018
|
+
Location: "/jobs/1"
|
9019
|
+
|
9020
|
+
+ Response 400
|
9021
|
+
+ Response 401
|
9022
|
+
+ Response 404
|
9023
|
+
+ Response 409
|
9024
|
+
+ Response 500
|
data/lib/xclarity_client.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'xclarity_client/version'
|
2
2
|
|
3
3
|
module XClarityClient
|
4
4
|
end
|
@@ -29,3 +29,5 @@ require 'xclarity_client/canister'
|
|
29
29
|
require 'xclarity_client/canister_management'
|
30
30
|
require 'xclarity_client/cabinet'
|
31
31
|
require 'xclarity_client/cabinet_management'
|
32
|
+
require 'xclarity_client/event'
|
33
|
+
require 'xclarity_client/event_management'
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module XClarityClient
|
2
2
|
class Client
|
3
|
-
|
4
3
|
def initialize(connection)
|
5
4
|
@connection = connection
|
6
5
|
end
|
@@ -17,28 +16,48 @@ module XClarityClient
|
|
17
16
|
CabinetManagement.new(@connection).population opts
|
18
17
|
end
|
19
18
|
|
20
|
-
def fetch_cabinet(uuids = nil,
|
21
|
-
|
19
|
+
def fetch_cabinet(uuids = nil,
|
20
|
+
includeAttributes = nil,
|
21
|
+
excludeAttributes = nil)
|
22
|
+
CabinetManagement.new(@connection).get_object(uuids,
|
23
|
+
includeAttributes,
|
24
|
+
excludeAttributes,
|
25
|
+
Cabinet)
|
22
26
|
end
|
23
27
|
|
24
28
|
def discover_canisters(opts = {})
|
25
29
|
CanisterManagement.new(@connection).population opts
|
26
30
|
end
|
27
31
|
|
28
|
-
def fetch_canisters(uuids = nil,
|
29
|
-
|
32
|
+
def fetch_canisters(uuids = nil,
|
33
|
+
includeAttributes = nil,
|
34
|
+
excludeAttributes = nil)
|
35
|
+
CanisterManagement.new(@connection).get_object(uuids,
|
36
|
+
includeAttributes,
|
37
|
+
excludeAttributes,
|
38
|
+
Canister)
|
30
39
|
end
|
31
40
|
|
32
41
|
def discover_cmms(opts = {})
|
33
42
|
CmmManagement.new(@connection).population opts
|
34
43
|
end
|
35
44
|
|
36
|
-
def fetch_cmms(uuids = nil,
|
37
|
-
|
45
|
+
def fetch_cmms(uuids = nil,
|
46
|
+
includeAttributes = nil,
|
47
|
+
excludeAttributes = nil)
|
48
|
+
CmmManagement.new(@connection).get_object(uuids,
|
49
|
+
includeAttributes,
|
50
|
+
excludeAttributes,
|
51
|
+
Cmm)
|
38
52
|
end
|
39
53
|
|
40
|
-
def fetch_fans(uuids = nil,
|
41
|
-
|
54
|
+
def fetch_fans(uuids = nil,
|
55
|
+
includeAttributes = nil,
|
56
|
+
excludeAttributes = nil)
|
57
|
+
FanManagement.new(@connection).get_object(uuids,
|
58
|
+
includeAttributes,
|
59
|
+
excludeAttributes,
|
60
|
+
Fan)
|
42
61
|
end
|
43
62
|
|
44
63
|
def discover_fans(opts = {})
|
@@ -53,8 +72,13 @@ module XClarityClient
|
|
53
72
|
FanMuxManagement.new(@connection).population opts
|
54
73
|
end
|
55
74
|
|
56
|
-
def fetch_fan_muxes(uuids = nil,
|
57
|
-
|
75
|
+
def fetch_fan_muxes(uuids = nil,
|
76
|
+
includeAttributes = nil,
|
77
|
+
excludeAttributes = nil)
|
78
|
+
FanMuxManagement.new(@connection).get_object(uuids,
|
79
|
+
includeAttributes,
|
80
|
+
excludeAttributes,
|
81
|
+
FanMux)
|
58
82
|
end
|
59
83
|
|
60
84
|
def discover_chassis(opts = {})
|
@@ -65,24 +89,83 @@ module XClarityClient
|
|
65
89
|
PowerSupplyManagement.new(@connection).population opts
|
66
90
|
end
|
67
91
|
|
68
|
-
def fetch_nodes(uuids = nil,
|
69
|
-
|
92
|
+
def fetch_nodes(uuids = nil,
|
93
|
+
includeAttributes = nil,
|
94
|
+
excludeAttributes = nil)
|
95
|
+
NodeManagement.new(@connection).get_object(uuids,
|
96
|
+
includeAttributes,
|
97
|
+
excludeAttributes,
|
98
|
+
Node)
|
99
|
+
end
|
100
|
+
|
101
|
+
def fetch_chassis(uuids = nil,
|
102
|
+
includeAttributes = nil,
|
103
|
+
excludeAttributes = nil)
|
104
|
+
ChassiManagement.new(@connection).get_object(uuids,
|
105
|
+
includeAttributes,
|
106
|
+
excludeAttributes,
|
107
|
+
Chassi)
|
108
|
+
end
|
109
|
+
|
110
|
+
def fetch_scalableComplexes(uuids = nil,
|
111
|
+
includeAttributes = nil,
|
112
|
+
excludeAttributes = nil)
|
113
|
+
ScalableComplexManagement.new(@connection).get_object(uuids,
|
114
|
+
includeAttributes,
|
115
|
+
excludeAttributes,
|
116
|
+
ScalableComplex)
|
117
|
+
end
|
118
|
+
|
119
|
+
def fetch_switches(uuids = nil,
|
120
|
+
includeAttributes = nil,
|
121
|
+
excludeAttributes = nil)
|
122
|
+
SwitchManagement.new(@connection).get_object(uuids,
|
123
|
+
includeAttributes,
|
124
|
+
excludeAttributes,
|
125
|
+
Switch)
|
126
|
+
end
|
127
|
+
|
128
|
+
def fetch_power_supplies(uuids = nil,
|
129
|
+
includeAttributes = nil,
|
130
|
+
excludeAttributes = nil)
|
131
|
+
PowerSupplyManagement.new(@connection).get_object(uuids,
|
132
|
+
includeAttributes,
|
133
|
+
excludeAttributes,
|
134
|
+
PowerSupply)
|
135
|
+
end
|
136
|
+
|
137
|
+
def discover_events
|
138
|
+
EventManagement.new(@connection).population
|
139
|
+
end
|
140
|
+
|
141
|
+
def fetch_events(opts = {})
|
142
|
+
EventManagement.new(@connection).get_object_with_opts(opts, Event)
|
143
|
+
end
|
144
|
+
|
145
|
+
def power_on_node(uuid = '')
|
146
|
+
NodeManagement.new(@connection).set_node_power_state(uuid, 'powerOn')
|
147
|
+
end
|
148
|
+
|
149
|
+
def power_off_node(uuid = '')
|
150
|
+
NodeManagement.new(@connection).set_node_power_state(uuid, 'powerOff')
|
70
151
|
end
|
71
152
|
|
72
|
-
def
|
73
|
-
|
153
|
+
def power_restart_node(uuid = '')
|
154
|
+
NodeManagement.new(@connection).set_node_power_state(uuid,
|
155
|
+
'powerCycleSoftGrace'
|
156
|
+
)
|
74
157
|
end
|
75
158
|
|
76
|
-
def
|
77
|
-
|
159
|
+
def blink_loc_led(uuid = '')
|
160
|
+
NodeManagement.new(@connection).set_loc_led_state(uuid, 'Blinking')
|
78
161
|
end
|
79
162
|
|
80
|
-
def
|
81
|
-
|
163
|
+
def turn_on_loc_led(uuid = '')
|
164
|
+
NodeManagement.new(@connection).set_loc_led_state(uuid, 'On')
|
82
165
|
end
|
83
166
|
|
84
|
-
def
|
85
|
-
|
167
|
+
def turn_off_loc_led(uuid = '')
|
168
|
+
NodeManagement.new(@connection).set_loc_led_state(uuid, 'Off')
|
86
169
|
end
|
87
170
|
end
|
88
171
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
class Event
|
3
|
+
include XClarityClient::Resource
|
4
|
+
|
5
|
+
BASE_URI = '/events'.freeze
|
6
|
+
LIST_NAME = 'eventList'.freeze
|
7
|
+
|
8
|
+
attr_accessor :action, :args, :bayText, :chassisText, :cn, :componentID, :eventClass, :eventDate,
|
9
|
+
:eventSourceText, :eventID, :failFRUs, :failSNs, :flags, :fruSerialNumberText, :localLogID,
|
10
|
+
:localLogSequence, :location, :msg, :msgID, :mtm, :originatorUUID, :parameters,
|
11
|
+
:serialnum, :severity, :severityText, :service, :serviceabilityText, :sourceID,
|
12
|
+
:sourceLogID, :sourceLogSequence, :systemFruNumberText, :systemName,
|
13
|
+
:systemSerialNumberText, :systemText, :systemTypeModelText, :systemTypeText, :timeStamp,
|
14
|
+
:typeText, :userid, :userIDIndex
|
15
|
+
|
16
|
+
def initialize(attributes)
|
17
|
+
build_resource(attributes)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module XClarityClient
|
4
|
+
class EventManagement < XClarityBase
|
5
|
+
|
6
|
+
include XClarityClient::ManagementMixin
|
7
|
+
|
8
|
+
def initialize(conf)
|
9
|
+
super(conf, Event::BASE_URI)
|
10
|
+
end
|
11
|
+
|
12
|
+
def population
|
13
|
+
get_all_resources(Event)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -3,7 +3,7 @@ require 'uuid'
|
|
3
3
|
|
4
4
|
module XClarityClient
|
5
5
|
class NodeManagement < XClarityBase
|
6
|
-
|
6
|
+
OFF = 1
|
7
7
|
include XClarityClient::ManagementMixin
|
8
8
|
|
9
9
|
def initialize(conf)
|
@@ -14,5 +14,21 @@ module XClarityClient
|
|
14
14
|
get_all_resources(Node, opts)
|
15
15
|
end
|
16
16
|
|
17
|
+
def set_node_power_state(uuid, powerState = OFF)
|
18
|
+
puts 'UUID to shutdown ' + uuid
|
19
|
+
power_request = case powerState
|
20
|
+
when OFF
|
21
|
+
JSON.generate(powerState: 'powerOff')
|
22
|
+
else
|
23
|
+
JSON.generate(powerState: 'powerOn')
|
24
|
+
end
|
25
|
+
|
26
|
+
do_put(Node::BASE_URI + '/' + uuid, power_request)
|
27
|
+
end
|
28
|
+
|
29
|
+
def set_loc_led_state(uuid, state, name = 'Identify')
|
30
|
+
request = JSON.generate(leds: [{ name: name, state: state }])
|
31
|
+
do_put("#{Node::BASE_URI}/#{uuid}", request)
|
32
|
+
end
|
17
33
|
end
|
18
34
|
end
|
@@ -37,6 +37,14 @@ module XClarityClient
|
|
37
37
|
@conn.get(uri + query)
|
38
38
|
end
|
39
39
|
|
40
|
+
def do_put (uri="", request = {})
|
41
|
+
@conn.put do |req|
|
42
|
+
req.url uri
|
43
|
+
req.headers['Content-Type'] = 'application/json'
|
44
|
+
req.body = request
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
40
48
|
def authentication(conf)
|
41
49
|
response = @conn.post do |request|
|
42
50
|
request.url '/session'
|
@@ -1,13 +1,12 @@
|
|
1
1
|
module XClarityClient
|
2
2
|
module ManagementMixin
|
3
|
-
|
4
|
-
|
5
3
|
def get_all_resources (resource, opts = {})
|
6
4
|
response = connection(resource::BASE_URI, opts)
|
7
5
|
|
8
6
|
return [] unless response.success?
|
9
|
-
|
7
|
+
|
10
8
|
body = JSON.parse(response.body)
|
9
|
+
body = {resource::LIST_NAME => body} if body.is_a? Array
|
11
10
|
body = {resource::LIST_NAME => [body]} unless body.has_key? resource::LIST_NAME
|
12
11
|
body[resource::LIST_NAME].map do |resource_params|
|
13
12
|
resource.new resource_params
|
@@ -31,6 +30,7 @@ module XClarityClient
|
|
31
30
|
return [] unless response.success?
|
32
31
|
|
33
32
|
body = JSON.parse(response.body)
|
33
|
+
body = {resource::LIST_NAME => body} if body.is_a? Array
|
34
34
|
body = {resource::LIST_NAME => [body]} unless body.has_key? resource::LIST_NAME
|
35
35
|
body[resource::LIST_NAME].map do |resource_params|
|
36
36
|
resource.new resource_params
|
@@ -58,8 +58,37 @@ module XClarityClient
|
|
58
58
|
else
|
59
59
|
connection(resource::BASE_URI + "?excludeAttributes=" + attributes.join(","))
|
60
60
|
end
|
61
|
-
|
62
61
|
end
|
63
62
|
|
63
|
+
def get_object_with_opts(opts, resource)
|
64
|
+
raise "The opts cannot be empty" if opts.empty?
|
65
|
+
filter = ""
|
66
|
+
|
67
|
+
response = if not opts.empty?
|
68
|
+
if not opts.has_key? "type"
|
69
|
+
if opts.has_key? "filterWith"
|
70
|
+
filter += "?filterWith="
|
71
|
+
filter += "#{opts["filterWith"]}"
|
72
|
+
|
73
|
+
elsif opts.has_key? "sort"
|
74
|
+
filter += ",sort=" if filter != ""
|
75
|
+
filter += "?sort=" if filter == ""
|
76
|
+
filter += "#{opts["sort"]}"
|
77
|
+
end
|
78
|
+
else
|
79
|
+
filter += "?type=#{opts["type"]}"
|
80
|
+
end
|
81
|
+
connection(resource::BASE_URI + filter)
|
82
|
+
end
|
83
|
+
|
84
|
+
return [] unless response.success?
|
85
|
+
|
86
|
+
body = JSON.parse(response.body)
|
87
|
+
body = {resource::LIST_NAME => body} if body.is_a? Array
|
88
|
+
body = {resource::LIST_NAME => [body]} unless body.has_key? resource::LIST_NAME
|
89
|
+
body[resource::LIST_NAME].map do |resource_params|
|
90
|
+
resource.new resource_params
|
91
|
+
end
|
92
|
+
end
|
64
93
|
end
|
65
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xclarity_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Cheal
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- docs/apib/canister.apib
|
132
132
|
- docs/apib/chassis.apib
|
133
133
|
- docs/apib/cmm.apib
|
134
|
+
- docs/apib/event.apib
|
134
135
|
- docs/apib/fan.apib
|
135
136
|
- docs/apib/fan_mux.apib
|
136
137
|
- docs/apib/fan_muxes.apib
|
@@ -151,6 +152,8 @@ files:
|
|
151
152
|
- lib/xclarity_client/cmm.rb
|
152
153
|
- lib/xclarity_client/cmm_management.rb
|
153
154
|
- lib/xclarity_client/configuration.rb
|
155
|
+
- lib/xclarity_client/event.rb
|
156
|
+
- lib/xclarity_client/event_management.rb
|
154
157
|
- lib/xclarity_client/fan.rb
|
155
158
|
- lib/xclarity_client/fan_management.rb
|
156
159
|
- lib/xclarity_client/fan_mux.rb
|
@@ -188,9 +191,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
191
|
version: '0'
|
189
192
|
requirements: []
|
190
193
|
rubyforge_project:
|
191
|
-
rubygems_version: 2.
|
194
|
+
rubygems_version: 2.5.1
|
192
195
|
signing_key:
|
193
196
|
specification_version: 4
|
194
197
|
summary: Lenovo XClairty API Client
|
195
198
|
test_files: []
|
196
|
-
has_rdoc:
|