xclarity_client 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/apib/ffdc.apib +17 -0
- data/docs/apib/jobs.apib +3757 -0
- data/docs/apib/update_repo.apib +1550 -0
- data/docs/apib/users.apib +387 -0
- data/lib/xclarity_client/client.rb +48 -0
- data/lib/xclarity_client/ffdc.rb +15 -0
- data/lib/xclarity_client/ffdc_management.rb +13 -0
- data/lib/xclarity_client/job.rb +16 -0
- data/lib/xclarity_client/job_management.rb +28 -0
- data/lib/xclarity_client/update_repo.rb +15 -0
- data/lib/xclarity_client/update_repo_management.rb +24 -0
- data/lib/xclarity_client/user.rb +18 -0
- data/lib/xclarity_client/user_management.rb +17 -0
- data/lib/xclarity_client/version.rb +1 -1
- data/lib/xclarity_client/xclarity_base.rb +7 -0
- data/lib/xclarity_client/xclarity_management_mixin.rb +46 -0
- data/lib/xclarity_client/xclarity_power_management_mixin.rb +2 -2
- data/lib/xclarity_client.rb +8 -0
- metadata +14 -2
@@ -0,0 +1,387 @@
|
|
1
|
+
FORMAT: 1A
|
2
|
+
|
3
|
+
# XClarity Users
|
4
|
+
|
5
|
+
# GET /userAccounts
|
6
|
+
|
7
|
+
+ Response 200 (application/json)
|
8
|
+
{
|
9
|
+
"response": [{
|
10
|
+
"ldapDn": "cn=SYSMGR_MK0XRF2I,ou=Users,dc=ibmbase,dc=com",
|
11
|
+
"activeSessions": 0,
|
12
|
+
"pwExpired": false,
|
13
|
+
"state": "Active",
|
14
|
+
"loginCount": 1,
|
15
|
+
"PasswordChangeFirstAccess": false,
|
16
|
+
"reserved": true,
|
17
|
+
"timeBeforeExpirationInDays": 68,
|
18
|
+
"modifyTimestamp": "2017-06-15T07:21:55Z",
|
19
|
+
"id": "d5d12b7b-45d9-444a-bda0-7801f6a782ed",
|
20
|
+
"createTimestamp": "2017-06-15T07:21:55Z",
|
21
|
+
"supervisor": false,
|
22
|
+
"lastLoginTimestamp": "",
|
23
|
+
"userPw": "NA",
|
24
|
+
"description": "System Manager",
|
25
|
+
"pwExpirationWarning": false,
|
26
|
+
"pwdAge": 1815701,
|
27
|
+
"userName": "SYSMGR_MK0XRF2I",
|
28
|
+
"groups": ["lxc-sysmgr"],
|
29
|
+
"loginAttempts": 1
|
30
|
+
}, {
|
31
|
+
"ldapDn": "cn=ADMIN,ou=Users,dc=ibmbase,dc=com",
|
32
|
+
"activeSessions": 1,
|
33
|
+
"pwExpired": false,
|
34
|
+
"state": "Active",
|
35
|
+
"loginCount": 2211,
|
36
|
+
"PasswordChangeFirstAccess": false,
|
37
|
+
"reserved": false,
|
38
|
+
"timeBeforeExpirationInDays": 34,
|
39
|
+
"modifyTimestamp": "2017-07-06T07:43:24Z",
|
40
|
+
"id": "aad6a497-566c-4323-a08e-6fd939defb54",
|
41
|
+
"createTimestamp": "2017-05-11T13:11:26Z",
|
42
|
+
"supervisor": true,
|
43
|
+
"lastLoginTimestamp": "2017-07-06T07:43:24Z",
|
44
|
+
"userPw": "NA",
|
45
|
+
"description": "",
|
46
|
+
"pwExpirationWarning": false,
|
47
|
+
"pwdAge": 4818730,
|
48
|
+
"userName": "ADMIN",
|
49
|
+
"groups": ["lxc-supervisor"],
|
50
|
+
"loginAttempts": 2211
|
51
|
+
}, {
|
52
|
+
"ldapDn": "cn=SYSRDR_BWMH0XO0,ou=Users,dc=ibmbase,dc=com",
|
53
|
+
"activeSessions": 0,
|
54
|
+
"pwExpired": false,
|
55
|
+
"state": "Active",
|
56
|
+
"loginCount": 1,
|
57
|
+
"PasswordChangeFirstAccess": false,
|
58
|
+
"reserved": true,
|
59
|
+
"timeBeforeExpirationInDays": 68,
|
60
|
+
"modifyTimestamp": "2017-06-15T07:21:55Z",
|
61
|
+
"id": "6a3ca55b-5bf1-406d-87fb-e0f44d5c0897",
|
62
|
+
"createTimestamp": "2017-06-15T07:21:55Z",
|
63
|
+
"supervisor": false,
|
64
|
+
"lastLoginTimestamp": "",
|
65
|
+
"userPw": "NA",
|
66
|
+
"description": "System reader",
|
67
|
+
"pwExpirationWarning": false,
|
68
|
+
"pwdAge": 1815701,
|
69
|
+
"userName": "SYSRDR_BWMH0XO0",
|
70
|
+
"groups": ["lxc-sysrdr"],
|
71
|
+
"loginAttempts": 1
|
72
|
+
}],
|
73
|
+
"result": "success",
|
74
|
+
"messages": [{
|
75
|
+
"id": "FQXHMSE0001I",
|
76
|
+
"text": "The request completed successfully.",
|
77
|
+
"explanation": "",
|
78
|
+
"recovery": {
|
79
|
+
"text": "Information only. No action is required.",
|
80
|
+
"URL": ""
|
81
|
+
}
|
82
|
+
}]
|
83
|
+
}
|
84
|
+
|
85
|
+
+ Response 400
|
86
|
+
+ Response 401
|
87
|
+
+ Response 404
|
88
|
+
+ Response 409
|
89
|
+
+ Response 500
|
90
|
+
|
91
|
+
# GET /userAccounts?includeAttributes=ldapDn,loginAttempts
|
92
|
+
|
93
|
+
+ Response 200 (application/json)
|
94
|
+
{
|
95
|
+
"response": [{
|
96
|
+
"ldapDn": "cn=SYSMGR_MK0XRF2I,ou=Users,dc=ibmbase,dc=com",
|
97
|
+
"activeSessions": 0,
|
98
|
+
"pwExpired": false,
|
99
|
+
"state": "Active",
|
100
|
+
"loginCount": 1,
|
101
|
+
"PasswordChangeFirstAccess": false,
|
102
|
+
"reserved": true,
|
103
|
+
"timeBeforeExpirationInDays": 68,
|
104
|
+
"modifyTimestamp": "2017-06-15T07:21:55Z",
|
105
|
+
"id": "d5d12b7b-45d9-444a-bda0-7801f6a782ed",
|
106
|
+
"createTimestamp": "2017-06-15T07:21:55Z",
|
107
|
+
"supervisor": false,
|
108
|
+
"lastLoginTimestamp": "",
|
109
|
+
"userPw": "NA",
|
110
|
+
"description": "System Manager",
|
111
|
+
"pwExpirationWarning": false,
|
112
|
+
"pwdAge": 1815701,
|
113
|
+
"userName": "SYSMGR_MK0XRF2I",
|
114
|
+
"groups": ["lxc-sysmgr"],
|
115
|
+
"loginAttempts": 1
|
116
|
+
}, {
|
117
|
+
"ldapDn": "cn=ADMIN,ou=Users,dc=ibmbase,dc=com",
|
118
|
+
"activeSessions": 1,
|
119
|
+
"pwExpired": false,
|
120
|
+
"state": "Active",
|
121
|
+
"loginCount": 2211,
|
122
|
+
"PasswordChangeFirstAccess": false,
|
123
|
+
"reserved": false,
|
124
|
+
"timeBeforeExpirationInDays": 34,
|
125
|
+
"modifyTimestamp": "2017-07-06T07:43:24Z",
|
126
|
+
"id": "aad6a497-566c-4323-a08e-6fd939defb54",
|
127
|
+
"createTimestamp": "2017-05-11T13:11:26Z",
|
128
|
+
"supervisor": true,
|
129
|
+
"lastLoginTimestamp": "2017-07-06T07:43:24Z",
|
130
|
+
"userPw": "NA",
|
131
|
+
"description": "",
|
132
|
+
"pwExpirationWarning": false,
|
133
|
+
"pwdAge": 4818730,
|
134
|
+
"userName": "ADMIN",
|
135
|
+
"groups": ["lxc-supervisor"],
|
136
|
+
"loginAttempts": 2211
|
137
|
+
}, {
|
138
|
+
"ldapDn": "cn=SYSRDR_BWMH0XO0,ou=Users,dc=ibmbase,dc=com",
|
139
|
+
"activeSessions": 0,
|
140
|
+
"pwExpired": false,
|
141
|
+
"state": "Active",
|
142
|
+
"loginCount": 1,
|
143
|
+
"PasswordChangeFirstAccess": false,
|
144
|
+
"reserved": true,
|
145
|
+
"timeBeforeExpirationInDays": 68,
|
146
|
+
"modifyTimestamp": "2017-06-15T07:21:55Z",
|
147
|
+
"id": "6a3ca55b-5bf1-406d-87fb-e0f44d5c0897",
|
148
|
+
"createTimestamp": "2017-06-15T07:21:55Z",
|
149
|
+
"supervisor": false,
|
150
|
+
"lastLoginTimestamp": "",
|
151
|
+
"userPw": "NA",
|
152
|
+
"description": "System reader",
|
153
|
+
"pwExpirationWarning": false,
|
154
|
+
"pwdAge": 1815701,
|
155
|
+
"userName": "SYSRDR_BWMH0XO0",
|
156
|
+
"groups": ["lxc-sysrdr"],
|
157
|
+
"loginAttempts": 1
|
158
|
+
}],
|
159
|
+
"result": "success",
|
160
|
+
"messages": [{
|
161
|
+
"id": "FQXHMSE0001I",
|
162
|
+
"text": "The request completed successfully.",
|
163
|
+
"explanation": "",
|
164
|
+
"recovery": {
|
165
|
+
"text": "Information only. No action is required.",
|
166
|
+
"URL": ""
|
167
|
+
}
|
168
|
+
}]
|
169
|
+
}
|
170
|
+
|
171
|
+
+ Response 400
|
172
|
+
+ Response 401
|
173
|
+
+ Response 404
|
174
|
+
+ Response 409
|
175
|
+
+ Response 500
|
176
|
+
|
177
|
+
# GET /userAccounts?excludeAttributes=ldapDn,loginAttempts
|
178
|
+
|
179
|
+
+ Response 200 (application/json)
|
180
|
+
{
|
181
|
+
"response": [{
|
182
|
+
"activeSessions": 0,
|
183
|
+
"pwExpired": false,
|
184
|
+
"state": "Active",
|
185
|
+
"loginCount": 1,
|
186
|
+
"PasswordChangeFirstAccess": false,
|
187
|
+
"reserved": true,
|
188
|
+
"timeBeforeExpirationInDays": 68,
|
189
|
+
"modifyTimestamp": "2017-06-15T07:21:55Z",
|
190
|
+
"id": "d5d12b7b-45d9-444a-bda0-7801f6a782ed",
|
191
|
+
"createTimestamp": "2017-06-15T07:21:55Z",
|
192
|
+
"supervisor": false,
|
193
|
+
"lastLoginTimestamp": "",
|
194
|
+
"userPw": "NA",
|
195
|
+
"description": "System Manager",
|
196
|
+
"pwExpirationWarning": false,
|
197
|
+
"pwdAge": 1815701,
|
198
|
+
"userName": "SYSMGR_MK0XRF2I",
|
199
|
+
"groups": ["lxc-sysmgr"]
|
200
|
+
}, {
|
201
|
+
"activeSessions": 1,
|
202
|
+
"pwExpired": false,
|
203
|
+
"state": "Active",
|
204
|
+
"loginCount": 2211,
|
205
|
+
"PasswordChangeFirstAccess": false,
|
206
|
+
"reserved": false,
|
207
|
+
"timeBeforeExpirationInDays": 34,
|
208
|
+
"modifyTimestamp": "2017-07-06T07:43:24Z",
|
209
|
+
"id": "aad6a497-566c-4323-a08e-6fd939defb54",
|
210
|
+
"createTimestamp": "2017-05-11T13:11:26Z",
|
211
|
+
"supervisor": true,
|
212
|
+
"lastLoginTimestamp": "2017-07-06T07:43:24Z",
|
213
|
+
"userPw": "NA",
|
214
|
+
"description": "",
|
215
|
+
"pwExpirationWarning": false,
|
216
|
+
"pwdAge": 4818730,
|
217
|
+
"userName": "ADMIN",
|
218
|
+
"groups": ["lxc-supervisor"]
|
219
|
+
}, {
|
220
|
+
"activeSessions": 0,
|
221
|
+
"pwExpired": false,
|
222
|
+
"state": "Active",
|
223
|
+
"loginCount": 1,
|
224
|
+
"PasswordChangeFirstAccess": false,
|
225
|
+
"reserved": true,
|
226
|
+
"timeBeforeExpirationInDays": 68,
|
227
|
+
"modifyTimestamp": "2017-06-15T07:21:55Z",
|
228
|
+
"id": "6a3ca55b-5bf1-406d-87fb-e0f44d5c0897",
|
229
|
+
"createTimestamp": "2017-06-15T07:21:55Z",
|
230
|
+
"supervisor": false,
|
231
|
+
"lastLoginTimestamp": "",
|
232
|
+
"userPw": "NA",
|
233
|
+
"description": "System reader",
|
234
|
+
"pwExpirationWarning": false,
|
235
|
+
"pwdAge": 1815701,
|
236
|
+
"userName": "SYSRDR_BWMH0XO0",
|
237
|
+
"groups": ["lxc-sysrdr"]
|
238
|
+
}],
|
239
|
+
"result": "success",
|
240
|
+
"messages": [{
|
241
|
+
"id": "FQXHMSE0001I",
|
242
|
+
"text": "The request completed successfully.",
|
243
|
+
"explanation": "",
|
244
|
+
"recovery": {
|
245
|
+
"text": "Information only. No action is required.",
|
246
|
+
"URL": ""
|
247
|
+
}
|
248
|
+
}]
|
249
|
+
}
|
250
|
+
|
251
|
+
+ Response 400
|
252
|
+
+ Response 401
|
253
|
+
+ Response 404
|
254
|
+
+ Response 409
|
255
|
+
+ Response 500
|
256
|
+
|
257
|
+
# GET /userAccounts/d5d12b7b-45d9-444a-bda0-7801f6a782ed
|
258
|
+
|
259
|
+
+ Response 200 (application/json)
|
260
|
+
{
|
261
|
+
"response": {
|
262
|
+
"ldapDn": "cn=SYSMGR_MK0XRF2I,ou=Users,dc=ibmbase,dc=com",
|
263
|
+
"activeSessions": 0,
|
264
|
+
"pwExpired": false,
|
265
|
+
"state": "Active",
|
266
|
+
"loginCount": 1,
|
267
|
+
"PasswordChangeFirstAccess": false,
|
268
|
+
"reserved": true,
|
269
|
+
"timeBeforeExpirationInDays": 68,
|
270
|
+
"modifyTimestamp": "2017-06-15T07:21:55Z",
|
271
|
+
"id": "d5d12b7b-45d9-444a-bda0-7801f6a782ed",
|
272
|
+
"createTimestamp": "2017-06-15T07:21:55Z",
|
273
|
+
"supervisor": false,
|
274
|
+
"lastLoginTimestamp": "",
|
275
|
+
"userPw": "NA",
|
276
|
+
"description": "System Manager",
|
277
|
+
"pwExpirationWarning": false,
|
278
|
+
"pwdAge": 1818070,
|
279
|
+
"userName": "SYSMGR_MK0XRF2I",
|
280
|
+
"groups": ["lxc-sysmgr"],
|
281
|
+
"loginAttempts": 1
|
282
|
+
},
|
283
|
+
"result": "success",
|
284
|
+
"messages": [{
|
285
|
+
"id": "FQXHMSE0001I",
|
286
|
+
"text": "The request completed successfully.",
|
287
|
+
"explanation": "",
|
288
|
+
"recovery": {
|
289
|
+
"text": "Information only. No action is required.",
|
290
|
+
"URL": ""
|
291
|
+
}
|
292
|
+
}]
|
293
|
+
}
|
294
|
+
|
295
|
+
+ Response 400
|
296
|
+
+ Response 401
|
297
|
+
+ Response 404
|
298
|
+
+ Response 409
|
299
|
+
+ Response 500
|
300
|
+
|
301
|
+
# GET /userAccounts/d5d12b7b-45d9-444a-bda0-7801f6a782ed?includeAttributes=ldapDn,loginAttempts
|
302
|
+
|
303
|
+
+ Response 200 (application/json)
|
304
|
+
{
|
305
|
+
"response": {
|
306
|
+
"ldapDn": "cn=SYSMGR_MK0XRF2I,ou=Users,dc=ibmbase,dc=com",
|
307
|
+
"activeSessions": 0,
|
308
|
+
"pwExpired": false,
|
309
|
+
"state": "Active",
|
310
|
+
"loginCount": 1,
|
311
|
+
"PasswordChangeFirstAccess": false,
|
312
|
+
"reserved": true,
|
313
|
+
"timeBeforeExpirationInDays": 68,
|
314
|
+
"modifyTimestamp": "2017-06-15T07:21:55Z",
|
315
|
+
"id": "d5d12b7b-45d9-444a-bda0-7801f6a782ed",
|
316
|
+
"createTimestamp": "2017-06-15T07:21:55Z",
|
317
|
+
"supervisor": false,
|
318
|
+
"lastLoginTimestamp": "",
|
319
|
+
"userPw": "NA",
|
320
|
+
"description": "System Manager",
|
321
|
+
"pwExpirationWarning": false,
|
322
|
+
"pwdAge": 1818070,
|
323
|
+
"userName": "SYSMGR_MK0XRF2I",
|
324
|
+
"groups": ["lxc-sysmgr"],
|
325
|
+
"loginAttempts": 1
|
326
|
+
},
|
327
|
+
"result": "success",
|
328
|
+
"messages": [{
|
329
|
+
"id": "FQXHMSE0001I",
|
330
|
+
"text": "The request completed successfully.",
|
331
|
+
"explanation": "",
|
332
|
+
"recovery": {
|
333
|
+
"text": "Information only. No action is required.",
|
334
|
+
"URL": ""
|
335
|
+
}
|
336
|
+
}]
|
337
|
+
}
|
338
|
+
|
339
|
+
+ Response 400
|
340
|
+
+ Response 401
|
341
|
+
+ Response 404
|
342
|
+
+ Response 409
|
343
|
+
+ Response 500
|
344
|
+
|
345
|
+
# GET /userAccounts/d5d12b7b-45d9-444a-bda0-7801f6a782ed?excludeAttributes=ldapDn,loginAttempts
|
346
|
+
|
347
|
+
+ Response 200 (application/json)
|
348
|
+
{
|
349
|
+
"response": {
|
350
|
+
"activeSessions": 0,
|
351
|
+
"pwExpired": false,
|
352
|
+
"state": "Active",
|
353
|
+
"loginCount": 1,
|
354
|
+
"PasswordChangeFirstAccess": false,
|
355
|
+
"reserved": true,
|
356
|
+
"timeBeforeExpirationInDays": 68,
|
357
|
+
"modifyTimestamp": "2017-06-15T07:21:55Z",
|
358
|
+
"id": "d5d12b7b-45d9-444a-bda0-7801f6a782ed",
|
359
|
+
"createTimestamp": "2017-06-15T07:21:55Z",
|
360
|
+
"supervisor": false,
|
361
|
+
"lastLoginTimestamp": "",
|
362
|
+
"userPw": "NA",
|
363
|
+
"description": "System Manager",
|
364
|
+
"pwExpirationWarning": false,
|
365
|
+
"pwdAge": 1818070,
|
366
|
+
"userName": "SYSMGR_MK0XRF2I",
|
367
|
+
"groups": ["lxc-sysmgr"]
|
368
|
+
},
|
369
|
+
"result": "success",
|
370
|
+
"messages": [{
|
371
|
+
"id": "FQXHMSE0001I",
|
372
|
+
"text": "The request completed successfully.",
|
373
|
+
"explanation": "",
|
374
|
+
"recovery": {
|
375
|
+
"text": "Information only. No action is required.",
|
376
|
+
"URL": ""
|
377
|
+
}
|
378
|
+
}]
|
379
|
+
}
|
380
|
+
|
381
|
+
+ Response 400
|
382
|
+
+ Response 401
|
383
|
+
+ Response 404
|
384
|
+
+ Response 409
|
385
|
+
+ Response 500
|
386
|
+
|
387
|
+
|
@@ -155,5 +155,53 @@ module XClarityClient
|
|
155
155
|
def turn_off_loc_led(uuid = '')
|
156
156
|
NodeManagement.new(@connection).set_loc_led_state(uuid, 'Off')
|
157
157
|
end
|
158
|
+
|
159
|
+
def fetch_ffdc(uuids = nil,
|
160
|
+
includeAttributes = nil,
|
161
|
+
excludeAttributes = nil)
|
162
|
+
FfdcManagement.new(@connection).get_object(uuids,
|
163
|
+
includeAttributes,
|
164
|
+
excludeAttributes,
|
165
|
+
Ffdc)
|
166
|
+
end
|
167
|
+
|
168
|
+
def discover_jobs(opts = {})
|
169
|
+
JobManagement.new(@connection).population opts
|
170
|
+
end
|
171
|
+
|
172
|
+
def fetch_jobs(ids = nil,
|
173
|
+
includeAttributes = nil,
|
174
|
+
excludeAttributes = nil)
|
175
|
+
JobManagement.new(@connection).get_object_with_id(ids,
|
176
|
+
includeAttributes,
|
177
|
+
excludeAttributes,
|
178
|
+
Job)
|
179
|
+
end
|
180
|
+
|
181
|
+
def cancel_job(id = '')
|
182
|
+
JobManagement.new(@connection).cancel_job(id)
|
183
|
+
end
|
184
|
+
|
185
|
+
def delete_job(id = '')
|
186
|
+
JobManagement.new(@connection).delete_job(id)
|
187
|
+
end
|
188
|
+
|
189
|
+
def discover_update_repo(opts = {})
|
190
|
+
UpdateRepoManagement.new(@connection).population opts
|
191
|
+
end
|
192
|
+
|
193
|
+
def discover_users(opts = {})
|
194
|
+
UserManagement.new(@connection).population
|
195
|
+
end
|
196
|
+
|
197
|
+
def fetch_users(ids = nil,
|
198
|
+
includeAttributes = nil,
|
199
|
+
excludeAttributes = nil)
|
200
|
+
UserManagement.new(@connection).get_object_with_id(ids,
|
201
|
+
includeAttributes,
|
202
|
+
excludeAttributes,
|
203
|
+
User)
|
204
|
+
end
|
205
|
+
|
158
206
|
end
|
159
207
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
class Ffdc
|
3
|
+
include XClarityClient::Resource
|
4
|
+
|
5
|
+
BASE_URI = '/ffdc/endpoint'.freeze
|
6
|
+
LIST_NAME = 'ffdcList'.freeze
|
7
|
+
|
8
|
+
attr_accessor :jobURL
|
9
|
+
|
10
|
+
def initialize(attributes)
|
11
|
+
build_resource(attributes)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
class Job
|
3
|
+
include XClarityClient::Resource
|
4
|
+
|
5
|
+
BASE_URI = '/jobs'.freeze
|
6
|
+
LIST_NAME = 'jobsList'.freeze
|
7
|
+
|
8
|
+
attr_accessor :status, :cancelledBy, :createdBy, :category, :typeId, :messageDisplay, :cancelURI,
|
9
|
+
:messageParameters, :startTime, :messageID, :messageBundle, :endTime, :id, :isCancelable, :uuid
|
10
|
+
|
11
|
+
def initialize(attributes)
|
12
|
+
build_resource(attributes)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module XClarityClient
|
4
|
+
class JobManagement < XClarityBase
|
5
|
+
|
6
|
+
include XClarityClient::ManagementMixin
|
7
|
+
|
8
|
+
def initialize(conf)
|
9
|
+
super(conf, Job::BASE_URI)
|
10
|
+
end
|
11
|
+
|
12
|
+
def population(opts = {})
|
13
|
+
get_all_resources(Job, opts)
|
14
|
+
end
|
15
|
+
|
16
|
+
def cancel_job(uuid='')
|
17
|
+
cancelReq = JSON.generate(cancelRequest: 'true')
|
18
|
+
response = do_put(Job::BASE_URI + '/' + uuid, cancelReq)
|
19
|
+
puts response.body
|
20
|
+
end
|
21
|
+
|
22
|
+
def delete_job(uuid='')
|
23
|
+
response = do_delete(Job::BASE_URI + '/' + uuid)
|
24
|
+
puts response.body
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
class UpdateRepo
|
3
|
+
include XClarityClient::Resource
|
4
|
+
|
5
|
+
BASE_URI = '/updateRepositories/firmware'.freeze
|
6
|
+
LIST_NAME = 'updateRepoList'.freeze
|
7
|
+
|
8
|
+
attr_accessor :importDir, :status, :lastRefreshed, :size, :publicKeys, :updates, :updatesByMt, :supportedMts, :updatesByMtByComp
|
9
|
+
|
10
|
+
def initialize(attributes)
|
11
|
+
build_resource(attributes)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module XClarityClient
|
4
|
+
class UpdateRepoManagement < XClarityBase
|
5
|
+
|
6
|
+
include XClarityClient::ManagementMixin
|
7
|
+
|
8
|
+
def initialize(conf)
|
9
|
+
super(conf, UpdateRepo::BASE_URI)
|
10
|
+
end
|
11
|
+
|
12
|
+
def population(opts = {})
|
13
|
+
raise "Option key must be provided for update_repo resource" if opts.empty?
|
14
|
+
raise "Option key must be provided for update_repo resource" if not (opts.has_key?(:key) || opts.has_key?("key"))
|
15
|
+
repoKey = opts[:key] || opts["key"]
|
16
|
+
if repoKey == "supportedMts" || repoKey == "size" || repoKey == "lastRefreshed" || repoKey == "importDir" || repoKey == "publicKeys" || repoKey == "updates" || repoKey == "updatesByMt" || repoKey == "updatesByMtByComp"
|
17
|
+
get_all_resources(UpdateRepo, opts)
|
18
|
+
else
|
19
|
+
raise "The value for option key should be one of these : supportedMts, lastRefreshed, size, importDir, publicKeys, updates, updatesByMt, updatesByMtByComp"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
class User
|
3
|
+
include XClarityClient::Resource
|
4
|
+
|
5
|
+
BASE_URI = '/userAccounts'.freeze
|
6
|
+
LIST_NAME = 'usersList'.freeze
|
7
|
+
|
8
|
+
attr_accessor :response, :PasswordChangeFirstAccess, :activeSessions, :createTimestamp, :description, :groups,
|
9
|
+
:id, :lastLoginTimestamp, :ldapDn, :loginAttempts, :loginCount, :modifyTimestamp, :pwExpirationWarning,
|
10
|
+
:pwExpired, :pwdAge, :reserved, :state, :supervisor, :timeBeforeExpirationInDays, :userName, :userPw,
|
11
|
+
:result, :messages
|
12
|
+
|
13
|
+
def initialize(attributes)
|
14
|
+
build_resource(attributes)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module XClarityClient
|
4
|
+
class UserManagement < XClarityBase
|
5
|
+
|
6
|
+
include XClarityClient::ManagementMixin
|
7
|
+
|
8
|
+
def initialize(conf)
|
9
|
+
super(conf, User::BASE_URI)
|
10
|
+
end
|
11
|
+
|
12
|
+
def population()
|
13
|
+
get_all_resources(User)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -65,6 +65,13 @@ module XClarityClient
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
def do_delete (uri="")
|
69
|
+
@conn.delete do |req|
|
70
|
+
req.url uri
|
71
|
+
req.headers['Content-Type'] = 'application/json'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
68
75
|
def authentication(conf)
|
69
76
|
response = @conn.post do |request|
|
70
77
|
request.url '/session'
|
@@ -10,6 +10,10 @@ module XClarityClient
|
|
10
10
|
return [] unless response.success?
|
11
11
|
|
12
12
|
body = JSON.parse(response.body)
|
13
|
+
if resource == XClarityClient::User
|
14
|
+
body = body['response']
|
15
|
+
end
|
16
|
+
|
13
17
|
body = {resource::LIST_NAME => body} if body.is_a? Array
|
14
18
|
body = {resource::LIST_NAME => [body]} unless body.has_key? resource::LIST_NAME
|
15
19
|
body[resource::LIST_NAME].map do |resource_params|
|
@@ -70,6 +74,48 @@ module XClarityClient
|
|
70
74
|
end
|
71
75
|
end
|
72
76
|
|
77
|
+
def get_object_with_id(ids, includeAttributes, excludeAttributes, resource)
|
78
|
+
response = if not includeAttributes.nil?
|
79
|
+
get_object_with_id_include_attributes(ids, includeAttributes, resource)
|
80
|
+
elsif not excludeAttributes.nil?
|
81
|
+
get_object_with_id_exclude_attributes(ids, excludeAttributes, resource)
|
82
|
+
elsif not ids.nil?
|
83
|
+
connection(resource::BASE_URI + "/" + ids.join(","))
|
84
|
+
else
|
85
|
+
connection(resource::BASE_URI)
|
86
|
+
end
|
87
|
+
|
88
|
+
return [] unless response.success?
|
89
|
+
|
90
|
+
body = JSON.parse(response.body)
|
91
|
+
|
92
|
+
if resource == XClarityClient::User
|
93
|
+
body = body['response']
|
94
|
+
end
|
95
|
+
|
96
|
+
body = {resource::LIST_NAME => body} if body.is_a? Array
|
97
|
+
body = {resource::LIST_NAME => [body]} unless body.has_key? resource::LIST_NAME
|
98
|
+
body[resource::LIST_NAME].map do |resource_params|
|
99
|
+
resource.new resource_params
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def get_object_with_id_include_attributes(uuids, attributes, resource)
|
104
|
+
response = if not uuids.nil?
|
105
|
+
connection(resource::BASE_URI + "/" + uuids.join(",") + "?includeAttributes=" + attributes.join(","))
|
106
|
+
else
|
107
|
+
connection(resource::BASE_URI + "?includeAttributes=" + attributes.join(","))
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def get_object_with_id_exclude_attributes(uuids, attributes, resource)
|
112
|
+
response = if not uuids.nil?
|
113
|
+
connection(resource::BASE_URI + "/#{uuids.join(",")}"+"?excludeAttributes=#{attributes.join(",")}")
|
114
|
+
else
|
115
|
+
connection(resource::BASE_URI + "?excludeAttributes=" + attributes.join(","))
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
73
119
|
def get_object_with_opts(opts, resource)
|
74
120
|
raise "The opts cannot be empty" if opts.empty?
|
75
121
|
filter = ""
|