xclarity_client 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +41 -0
  3. data/.rubocop_base.yml +211 -0
  4. data/.rubocop_cc.yml +2 -0
  5. data/.travis.yml +1 -1
  6. data/docs/apib/compliance_policies.apib +214 -0
  7. data/docs/apib/squisher.rb +21 -13
  8. data/docs/apib/storages.apib +481 -0
  9. data/docs/apib/switches.apib +4 -0
  10. data/lib/xclarity_client.rb +3 -4
  11. data/lib/xclarity_client/client.rb +37 -343
  12. data/lib/xclarity_client/connection/connection.rb +3 -3
  13. data/lib/xclarity_client/endpoints/compliance_policy.rb +19 -0
  14. data/lib/xclarity_client/endpoints/endpoints.rb +2 -0
  15. data/lib/xclarity_client/endpoints/node.rb +8 -0
  16. data/lib/xclarity_client/endpoints/storage.rb +18 -0
  17. data/lib/xclarity_client/endpoints/switch.rb +3 -0
  18. data/lib/xclarity_client/mixins/aicc_mixin.rb +10 -0
  19. data/lib/xclarity_client/mixins/cabinet_mixin.rb +20 -0
  20. data/lib/xclarity_client/mixins/canister_mixin.rb +20 -0
  21. data/lib/xclarity_client/mixins/chassi_mixin.rb +20 -0
  22. data/lib/xclarity_client/mixins/cmm_mixin.rb +20 -0
  23. data/lib/xclarity_client/mixins/compliance_policy_mixin.rb +38 -0
  24. data/lib/xclarity_client/mixins/config_pattern_mixin.rb +40 -0
  25. data/lib/xclarity_client/mixins/config_profile_mixin.rb +51 -0
  26. data/lib/xclarity_client/mixins/config_target_mixin.rb +16 -0
  27. data/lib/xclarity_client/mixins/discover_request_mixin.rb +18 -0
  28. data/lib/xclarity_client/mixins/discovery_mixin.rb +10 -0
  29. data/lib/xclarity_client/mixins/event_mixin.rb +14 -0
  30. data/lib/xclarity_client/mixins/fan_mixin.rb +20 -0
  31. data/lib/xclarity_client/mixins/fan_mux_mixin.rb +20 -0
  32. data/lib/xclarity_client/mixins/ffdc_mixin.rb +16 -0
  33. data/lib/xclarity_client/mixins/global_setting_mixin.rb +14 -0
  34. data/lib/xclarity_client/mixins/host_platform_mixin.rb +18 -0
  35. data/lib/xclarity_client/mixins/job_mixin.rb +32 -0
  36. data/lib/xclarity_client/mixins/mixins.rb +38 -0
  37. data/lib/xclarity_client/mixins/node_mixin.rb +66 -0
  38. data/lib/xclarity_client/mixins/os_image_mixin.rb +14 -0
  39. data/lib/xclarity_client/mixins/persisted_result_mixin.rb +10 -0
  40. data/lib/xclarity_client/mixins/power_supply_mixin.rb +20 -0
  41. data/lib/xclarity_client/mixins/remote_access_mixin.rb +10 -0
  42. data/lib/xclarity_client/mixins/remote_file_server_mixin.rb +28 -0
  43. data/lib/xclarity_client/mixins/scalable_complex_mixin.rb +20 -0
  44. data/lib/xclarity_client/mixins/storage_mixin.rb +20 -0
  45. data/lib/xclarity_client/mixins/switch_mixin.rb +30 -0
  46. data/lib/xclarity_client/mixins/unmanage_request_mixin.rb +18 -0
  47. data/lib/xclarity_client/mixins/update_repo_mixin.rb +10 -0
  48. data/lib/xclarity_client/mixins/user_mixin.rb +26 -0
  49. data/lib/xclarity_client/schemas.rb +184 -189
  50. data/lib/xclarity_client/services/aicc_management.rb +0 -4
  51. data/lib/xclarity_client/services/cabinet_management.rb +0 -4
  52. data/lib/xclarity_client/services/canister_management.rb +0 -4
  53. data/lib/xclarity_client/services/chassi_management.rb +0 -4
  54. data/lib/xclarity_client/services/cmm_management.rb +0 -4
  55. data/lib/xclarity_client/services/compliance_policy_management.rb +52 -0
  56. data/lib/xclarity_client/services/config_pattern_management.rb +0 -4
  57. data/lib/xclarity_client/services/config_profile_management.rb +0 -4
  58. data/lib/xclarity_client/services/config_target_management.rb +0 -4
  59. data/lib/xclarity_client/services/discover_request_management.rb +0 -4
  60. data/lib/xclarity_client/services/discovery_management.rb +0 -4
  61. data/lib/xclarity_client/services/event_management.rb +0 -4
  62. data/lib/xclarity_client/services/fan_management.rb +0 -4
  63. data/lib/xclarity_client/services/fan_mux_management.rb +0 -4
  64. data/lib/xclarity_client/services/ffdc_management.rb +0 -4
  65. data/lib/xclarity_client/services/job_management.rb +0 -9
  66. data/lib/xclarity_client/services/mixins/power_action_sender_mixin.rb +59 -0
  67. data/lib/xclarity_client/services/node_management.rb +3 -26
  68. data/lib/xclarity_client/services/osimage_management.rb +25 -27
  69. data/lib/xclarity_client/services/persisted_result_management.rb +0 -6
  70. data/lib/xclarity_client/services/power_supply_management.rb +0 -4
  71. data/lib/xclarity_client/services/scalable_complex_management.rb +0 -4
  72. data/lib/xclarity_client/services/services.rb +6 -4
  73. data/lib/xclarity_client/services/storage_management.rb +8 -0
  74. data/lib/xclarity_client/services/switch_management.rb +4 -4
  75. data/lib/xclarity_client/services/unmanage_request_management.rb +0 -4
  76. data/lib/xclarity_client/services/update_repo_management.rb +30 -9
  77. data/lib/xclarity_client/services/user_management.rb +0 -4
  78. data/lib/xclarity_client/services/xclarity_service.rb +6 -5
  79. data/lib/xclarity_client/version.rb +1 -1
  80. data/xclarity_client.gemspec +1 -1
  81. metadata +45 -5
  82. data/lib/xclarity_client/xclarity_power_management_mixin.rb +0 -36
@@ -1594,3 +1594,7 @@ FORMAT: 1A
1594
1594
  + Response 404
1595
1595
  + Response 409
1596
1596
  + Response 500
1597
+
1598
+ # PUT /switches/1B33D6D13F267A614567A897DC784F00
1599
+
1600
+ + Response 200 (application/json)
@@ -9,11 +9,10 @@ require 'xclarity_client/errors/errors'
9
9
 
10
10
  require 'xclarity_client/configuration'
11
11
  require 'xclarity_client/xclarity_base'
12
- require 'xclarity_client/xclarity_power_management_mixin'
13
12
  require 'xclarity_client/xclarity_credentials_validator'
14
13
  require 'xclarity_client/discover'
15
- require 'xclarity_client/client'
16
- require 'xclarity_client/schemas'
17
-
18
14
  require 'xclarity_client/endpoints/endpoints'
19
15
  require 'xclarity_client/services/services'
16
+ require 'xclarity_client/mixins/mixins'
17
+ require 'xclarity_client/client'
18
+ require 'xclarity_client/schemas'
@@ -1,351 +1,45 @@
1
1
  module XClarityClient
2
+ #
3
+ # Facade that exposes the lib features
4
+ #
2
5
  class Client
3
- include XClarityClient::PowerManagementMixin
4
-
5
- def initialize(connection)
6
- @connection = connection
7
- end
8
-
9
- def discover_nodes(opts = {})
10
- NodeManagement.new(@connection).population opts
11
- end
12
-
13
- def discover_aicc(opts = {})
14
- AiccManagement.new(@connection).population opts
15
- end
16
-
17
- def discover_scalableComplexes(opts = {})
18
- ScalableComplexManagement.new(@connection).population opts
19
- end
20
-
21
- def discover_cabinet(opts = {})
22
- CabinetManagement.new(@connection).population opts
23
- end
24
-
25
- def fetch_cabinet(uuids = nil,
26
- includeAttributes = nil,
27
- excludeAttributes = nil)
28
- CabinetManagement.new(@connection).get_object(uuids,
29
- includeAttributes,
30
- excludeAttributes)
31
- end
32
-
33
- def discover_canisters(opts = {})
34
- CanisterManagement.new(@connection).population opts
35
- end
36
-
37
- def fetch_canisters(uuids = nil,
38
- includeAttributes = nil,
39
- excludeAttributes = nil)
40
- CanisterManagement.new(@connection).get_object(uuids,
41
- includeAttributes,
42
- excludeAttributes)
43
- end
44
-
45
- def discover_cmms(opts = {})
46
- CmmManagement.new(@connection).population opts
47
- end
48
-
49
- def fetch_cmms(uuids = nil,
50
- includeAttributes = nil,
51
- excludeAttributes = nil)
52
- CmmManagement.new(@connection).get_object(uuids,
53
- includeAttributes,
54
- excludeAttributes)
55
- end
56
-
57
- def fetch_fans(uuids = nil,
58
- includeAttributes = nil,
59
- excludeAttributes = nil)
60
- FanManagement.new(@connection).get_object(uuids,
61
- includeAttributes,
62
- excludeAttributes)
63
- end
64
-
65
- def discover_fans(opts = {})
66
- FanManagement.new(@connection).population opts
67
- end
68
-
69
- def discover_switches(opts = {})
70
- SwitchManagement.new(@connection).population opts
71
- end
72
-
73
- def discover_fan_muxes(opts = {})
74
- FanMuxManagement.new(@connection).population opts
75
- end
76
-
77
- def fetch_fan_muxes(uuids = nil,
78
- includeAttributes = nil,
79
- excludeAttributes = nil)
80
- FanMuxManagement.new(@connection).get_object(uuids,
81
- includeAttributes,
82
- excludeAttributes)
83
- end
84
-
85
- def discover_chassis(opts = {})
86
- ChassiManagement.new(@connection).population opts
87
- end
88
-
89
- def discover_power_supplies(opts = {})
90
- PowerSupplyManagement.new(@connection).population opts
91
- end
92
-
93
- def fetch_nodes(uuids = nil,
94
- includeAttributes = nil,
95
- excludeAttributes = nil)
96
- NodeManagement.new(@connection).get_object(uuids,
97
- includeAttributes,
98
- excludeAttributes)
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
- end
108
-
109
- def fetch_scalableComplexes(uuids = nil,
110
- includeAttributes = nil,
111
- excludeAttributes = nil)
112
- ScalableComplexManagement.new(@connection).get_object(uuids,
113
- includeAttributes,
114
- excludeAttributes)
115
- end
116
-
117
- def fetch_switches(uuids = nil,
118
- includeAttributes = nil,
119
- excludeAttributes = nil)
120
- SwitchManagement.new(@connection).get_object(uuids,
121
- includeAttributes,
122
- excludeAttributes)
123
- end
124
-
125
- def fetch_power_supplies(uuids = nil,
126
- includeAttributes = nil,
127
- excludeAttributes = nil)
128
- PowerSupplyManagement.new(@connection).get_object(uuids,
129
- includeAttributes,
130
- excludeAttributes)
131
- end
132
-
133
- def discover_events
134
- EventManagement.new(@connection).population
135
- end
136
-
137
- def fetch_events(opts = {})
138
- EventManagement.new(@connection).get_object_with_opts(opts, Event)
139
- end
140
-
141
- def blink_loc_led(uuid = '')
142
- NodeManagement.new(@connection).set_loc_led_state(uuid, 'Blinking')
143
- end
144
-
145
- def turn_on_loc_led(uuid = '')
146
- NodeManagement.new(@connection).set_loc_led_state(uuid, 'On')
147
- end
148
-
149
- def turn_off_loc_led(uuid = '')
150
- NodeManagement.new(@connection).set_loc_led_state(uuid, 'Off')
151
- end
152
-
153
- def fetch_ffdc(uuids = nil,
154
- includeAttributes = nil,
155
- excludeAttributes = nil)
156
- FfdcManagement.new(@connection).get_object(uuids,
157
- includeAttributes,
158
- excludeAttributes)
159
- end
160
-
161
- def discover_jobs(opts = {})
162
- JobManagement.new(@connection).population opts
163
- end
164
-
165
- def fetch_jobs(ids = nil,
166
- includeAttributes = nil,
167
- excludeAttributes = nil)
168
- JobManagement.new(@connection).get_object_with_id(ids,
169
- includeAttributes,
170
- excludeAttributes)
171
- end
172
-
173
- def cancel_job(id = '')
174
- JobManagement.new(@connection).cancel_job(id)
175
- end
176
-
177
- def delete_job(id = '')
178
- JobManagement.new(@connection).delete_job(id)
179
- end
180
-
181
- def get_job(job_id = "")
182
- JobManagement.new(@connection).get_job(job_id)
183
- end
184
-
185
- def discover_update_repo(opts = {})
186
- UpdateRepoManagement.new(@connection).population opts
187
- end
188
-
189
- def discover_users(opts = {})
190
- UserManagement.new(@connection).population
191
- end
192
-
193
- def fetch_users(ids = nil,
194
- includeAttributes = nil,
195
- excludeAttributes = nil)
196
- UserManagement.new(@connection).get_object_with_id(ids,
197
- includeAttributes,
198
- excludeAttributes)
199
- end
200
-
201
- def change_user_password(current_password, new_password)
202
- UserManagement.new(@connection).change_password(current_password, new_password)
203
- end
204
-
205
- def fetch_config_target(ids=nil,
206
- includeAttributes = nil,
207
- excludeAttributes = nil)
208
- ConfigTargetManagement.new(@connection).get_object_with_id(ids,
209
- includeAttributes,
210
- excludeAttributes)
211
- end
212
-
213
- def fetch_config_profile(ids=nil,
214
- includeAttributes = nil,
215
- excludeAttributes = nil)
216
- ConfigProfileManagement.new(@connection).get_object_with_id(ids,
217
- includeAttributes,
218
- excludeAttributes)
219
- end
220
-
221
- def discover_config_profile
222
- ConfigProfileManagement.new(@connection).population
223
- end
224
-
225
- def rename_config_profile(id='', name='')
226
- ConfigProfileManagement.new(@connection).rename_config_profile(id,
227
- name)
228
- end
229
-
230
- def activate_config_profile(id='', endpoint_uuid='', restart='')
231
- ConfigProfileManagement.new(@connection).activate_config_profile(id,
232
- endpoint_uuid,
233
- restart)
234
- end
235
-
236
- def unassign_config_profile(id='', powerDown='',resetImm='',force='')
237
- ConfigProfileManagement.new(@connection).unassign_config_profile(id,
238
- powerDown,
239
- resetImm,
240
- force)
241
- end
242
-
243
- def delete_config_profile(id='')
244
- ConfigProfileManagement.new(@connection).delete_config_profile(id)
245
- end
246
-
247
- def fetch_config_pattern(ids=nil,
248
- includeAttributes = nil,
249
- excludeAttributes = nil)
250
- ConfigPatternManagement.new(@connection).get_object_with_id(ids,
251
- includeAttributes,
252
- excludeAttributes)
253
- end
254
-
255
- def discover_config_pattern
256
- ConfigPatternManagement.new(@connection).population
257
- end
258
-
259
- def export_config_pattern(id='')
260
- ConfigPatternManagement.new(@connection).export(id)
261
- end
262
-
263
- def deploy_config_pattern(id='',endpoints=nil,restart='',etype='')
264
- ConfigPatternManagement.new(@connection).deploy_config_pattern(id,
265
- endpoints,
266
- restart,
267
- etype)
268
- end
269
-
270
- def import_config_pattern(config_pattern = {})
271
- ConfigPatternManagement.new(@connection).import_config_pattern(config_pattern)
6
+ include XClarityClient::Mixins::AiccMixin
7
+ include XClarityClient::Mixins::CabinetMixin
8
+ include XClarityClient::Mixins::CanisterMixin
9
+ include XClarityClient::Mixins::ChassiMixin
10
+ include XClarityClient::Mixins::CmmMixin
11
+ include XClarityClient::Mixins::CompliancePolicyMixin
12
+ include XClarityClient::Mixins::ConfigPatternMixin
13
+ include XClarityClient::Mixins::ConfigProfileMixin
14
+ include XClarityClient::Mixins::ConfigTargetMixin
15
+ include XClarityClient::Mixins::DiscoverMixin
16
+ include XClarityClient::Mixins::DiscoverRequestMixin
17
+ include XClarityClient::Mixins::EventMixin
18
+ include XClarityClient::Mixins::FanMixin
19
+ include XClarityClient::Mixins::FanMuxMixin
20
+ include XClarityClient::Mixins::FfdcMixin
21
+ include XClarityClient::Mixins::GlobalSettingMixin
22
+ include XClarityClient::Mixins::HostPlatformMixin
23
+ include XClarityClient::Mixins::JobMixin
24
+ include XClarityClient::Mixins::NodeMixin
25
+ include XClarityClient::Mixins::OsImageMixin
26
+ include XClarityClient::Mixins::PersistedResultMixin
27
+ include XClarityClient::Mixins::PowerSupplyMixin
28
+ include XClarityClient::Mixins::RemoteAccessMixin
29
+ include XClarityClient::Mixins::RemoteFileServerMixin
30
+ include XClarityClient::Mixins::ScalableComplexMixin
31
+ include XClarityClient::Mixins::StorageMixin
32
+ include XClarityClient::Mixins::SwitchMixin
33
+ include XClarityClient::Mixins::UnmanageRequestMixin
34
+ include XClarityClient::Mixins::UpdateRepoMixin
35
+ include XClarityClient::Mixins::UserMixin
36
+
37
+ def initialize(config)
38
+ @config = config
272
39
  end
273
40
 
274
41
  def validate_configuration
275
- XClarityCredentialsValidator.new(@connection).validate
276
- end
277
-
278
- def discover_manageable_devices(ip_addresses)
279
- DiscoverRequestManagement.new(@connection).discover_manageable_devices(ip_addresses)
280
- end
281
-
282
- def discover_devices_by_slp
283
- DiscoveryManagement.new(@connection).population
42
+ XClarityCredentialsValidator.new(@config).validate
284
43
  end
285
-
286
- def monitor_discover_request(job_id)
287
- DiscoverRequestManagement.new(@connection).monitor_discover_request(job_id)
288
- end
289
-
290
- def fetch_unmanage_request(job_id)
291
- UnmanageRequestManagement.new(@connection).fetch_unmanage_request(job_id)
292
- end
293
-
294
- def unmanage_discovered_devices(endpoints, force)
295
- UnmanageRequestManagement.new(@connection).unmanage_discovered_devices(endpoints, force)
296
- end
297
-
298
- def fetch_compliance_policies
299
- PersistedResultManagement.new(@connection).population
300
- end
301
-
302
- def remote_control(uuid)
303
- RemoteAccessManagement.new(@connection).remote_control uuid
304
- end
305
-
306
- def get_remotefileserver_profiles
307
- RemoteFileServerManagement.new(@connection).population
308
- end
309
-
310
- def create_remotefileserver_profile(opts = {})
311
- RemoteFileServerManagement.new(@connection).create_remotefileserver_profile(opts)
312
- end
313
-
314
- def delete_remotefileserver_profile(serverId = "")
315
- RemoteFileServerManagement.new(@connection).delete_remotefileserver_profile(serverId)
316
- end
317
-
318
- def get_remotefileserver_profile(serverId = "")
319
- RemoteFileServerManagement.new(@connection).get_remotefileserver_profile(serverId)
320
- end
321
-
322
- def import_osimage(serverId = "", path = "")
323
- OsImageManagement.new(@connection).import_osimage(serverId, path)
324
- end
325
-
326
- def get_osimages
327
- OsImageManagement.new(@connection).population
328
- end
329
-
330
- def get_hostplatforms
331
- HostPlatformManagement.new(@connection).population
332
- end
333
-
334
- def get_osimage_deployment_status(uuid = "")
335
- HostPlatformManagement.new(@connection).get_osimage_deployment_status(uuid)
336
- end
337
-
338
- def deploy_osimage(opts = [])
339
- HostPlatformManagement.new(@connection).deploy_osimage(opts)
340
- end
341
-
342
- def get_globalsettings
343
- GlobalSettingManagement.new(@connection).population
344
- end
345
-
346
- def set_globalsettings(opts = {})
347
- GlobalSettingManagement.new(@connection).set_globalsettings(opts)
348
- end
349
-
350
44
  end
351
45
  end
@@ -29,8 +29,8 @@ module XClarityClient
29
29
  # @param [String] uri - endpoint to do the request
30
30
  # @param [Hash] query - params to query the endpoint resources
31
31
  #
32
- def do_get(uri = "", query = "")
33
- url_query = query.size > 0 ? "?" + query.map {|k, v| "#{k}=#{v}"}.join(",") : ""
32
+ def do_get(uri = "", query = {})
33
+ url_query = query.size > 0 ? "?" + query.map {|k, v| "#{k}=#{v}"}.join("&") : ""
34
34
  @connection.get(uri + url_query)
35
35
  rescue Faraday::Error::ConnectionFailed => e
36
36
  $lxca_log.error "XClarityClient::XclarityBase connection", "Error trying to send a GET to #{uri + url_query}"
@@ -115,4 +115,4 @@ module XClarityClient
115
115
  connection
116
116
  end
117
117
  end
118
- end
118
+ end
@@ -0,0 +1,19 @@
1
+ module XClarityClient
2
+ class CompliancePolicy < Endpoints::XclarityEndpoint
3
+
4
+ BASE_URI = '/compliancePolicies'.freeze
5
+ LIST_NAME = 'updatePolicyList'.freeze
6
+ SUB_URIS = {
7
+ applicableFirmware: "#{BASE_URI}/applicableFirmware",
8
+ persistedResult: "#{BASE_URI}/persistedResult",
9
+ compareResult: "#{BASE_URI}/compareResult"
10
+ }
11
+
12
+ attr_accessor :policies, :id, :inUse, :lastModified, :name, :updateRule, :userDefined,
13
+ :description, :details, :componentTypes, :applicableFirmware,
14
+ :machineType, :uuid, :jobid, :percentage, :result, :endpointCompliant,
15
+ :message, :status, :targetFirmware, :taskid, :all, :chassis, :cmms,
16
+ :racklist, :rackswitchlist, :storagelist, :switches, :xITEs, :message,
17
+ :success, :messages, :explanation, :recovery, :text
18
+ end
19
+ end