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
@@ -0,0 +1,8 @@
1
+ module XClarityClient
2
+ #
3
+ # This class provides a set of services related to Storage endpoint
4
+ #
5
+ class StorageManagement < Services::XClarityService
6
+ manages_endpoint Storage
7
+ end
8
+ end
@@ -1,9 +1,9 @@
1
+ require 'xclarity_client/services/mixins/power_action_sender_mixin'
2
+
1
3
  module XClarityClient
2
4
  class SwitchManagement< Services::XClarityService
3
- manages_endpoint Switch
5
+ include Services::PowerActionSenderMixin
4
6
 
5
- def population(opts = {})
6
- fetch_all(opts)
7
- end
7
+ manages_endpoint Switch
8
8
  end
9
9
  end
@@ -4,10 +4,6 @@ module XClarityClient
4
4
  class UnmanageRequestManagement< Services::XClarityService
5
5
  manages_endpoint UnmanageRequest
6
6
 
7
- def population(opts = {})
8
- fetch_all(opts)
9
- end
10
-
11
7
  def unmanage_discovered_devices(endpoints, force)
12
8
  deploy_hash = {}
13
9
  deploy_hash.merge!({:endpoints => endpoints})
@@ -2,15 +2,36 @@ module XClarityClient
2
2
  class UpdateRepoManagement < Services::XClarityService
3
3
  manages_endpoint UpdateRepo
4
4
 
5
- def population(opts = {})
6
- raise "Option key must be provided for update_repo resource" if opts.empty?
7
- raise "Option key must be provided for update_repo resource" if not (opts.has_key?(:key) || opts.has_key?("key"))
8
- repoKey = opts[:key] || opts["key"]
9
- if repoKey == "supportedMts" || repoKey == "size" || repoKey == "lastRefreshed" || repoKey == "importDir" || repoKey == "publicKeys" || repoKey == "updates" || repoKey == "updatesByMt" || repoKey == "updatesByMtByComp"
10
- fetch_all(opts)
11
- else
12
- raise "The value for option key should be one of these : supportedMts, lastRefreshed, size, importDir, publicKeys, updates, updatesByMt, updatesByMtByComp"
13
- end
5
+ def fetch_all(opts = {})
6
+ validate_opts(opts)
7
+ super(opts)
8
+ end
9
+
10
+ private
11
+
12
+ def validate_opts(opts)
13
+ err_missing_key = 'Option key must be provided for update_repo resource'
14
+ err_wrong_key = 'The value for option key should be one of these : '\
15
+ "#{allowed_keys.join(', ')}"
16
+
17
+ raise err_missing_key if opts.empty? || !(opts[:key] || opts['key'])
18
+
19
+ repo_key = opts[:key] || opts['key']
20
+
21
+ raise err_wrong_key unless allowed_keys.include?(repo_key)
22
+ end
23
+
24
+ def allowed_keys
25
+ %w(
26
+ supportedMts
27
+ size
28
+ lastRefreshed
29
+ importDir
30
+ publicKeys
31
+ updates
32
+ updatesByMt
33
+ updatesByMtByComp
34
+ )
14
35
  end
15
36
  end
16
37
  end
@@ -4,10 +4,6 @@ module XClarityClient
4
4
  class UserManagement < Services::XClarityService
5
5
  manages_endpoint User
6
6
 
7
- def population(opts = {})
8
- fetch_all(opts)
9
- end
10
-
11
7
  def change_password(current_password, new_password)
12
8
  payload = {
13
9
  password: current_password,
@@ -34,14 +34,15 @@ module XClarityClient
34
34
  $lxca_log.info "XclarityClient::Endpoints::XClarityService get_object",
35
35
  "Sending request to #{managed_resource} resource"
36
36
 
37
- uuids.reject! { |uuid| UUID.validate(uuid).nil? } unless uuids.nil?
37
+ uuid_array = uuids&.reject { |uuid| uuid.nil? || uuid.empty? }
38
38
 
39
39
  response = if not includeAttributes.nil?
40
- get_object_with_include_attributes(uuids, includeAttributes)
40
+ get_object_with_include_attributes(uuid_array, includeAttributes)
41
41
  elsif not excludeAttributes.nil?
42
- get_object_with_exclude_attributes(uuids, excludeAttributes)
43
- elsif not uuids.nil?
44
- @connection.do_get(managed_resource::BASE_URI + "/" + uuids.join(","))
42
+ get_object_with_exclude_attributes(uuid_array, excludeAttributes)
43
+ elsif not uuid_array.nil?
44
+ @connection.do_get(managed_resource::BASE_URI + "/" +
45
+ uuid_array.join(","))
45
46
  else
46
47
  @connection.do_get(managed_resource::BASE_URI)
47
48
  end
@@ -1,3 +1,3 @@
1
1
  module XClarityClient
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "rspec", "~> 3.0"
23
23
  spec.add_development_dependency "apib-mock_server", "~> 1.0.3"
24
24
  spec.add_development_dependency "webmock", "~> 2.1.0"
25
- spec.add_dependency "faraday", "~> 0.9.2"
25
+ spec.add_dependency "faraday", "~> 0.9"
26
26
  spec.add_dependency "faraday-cookie_jar", "~> 0.0.6"
27
27
  spec.add_dependency "uuid", "~> 2.3.8"
28
28
  spec.add_dependency "faker", "~> 1.8.3"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xclarity_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manasa Rao
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-04-06 00:00:00.000000000 Z
12
+ date: 2018-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 0.9.2
90
+ version: '0.9'
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 0.9.2
97
+ version: '0.9'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: faraday-cookie_jar
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -159,8 +159,11 @@ executables: []
159
159
  extensions: []
160
160
  extra_rdoc_files: []
161
161
  files:
162
+ - ".codeclimate.yml"
162
163
  - ".gitignore"
163
164
  - ".rspec"
165
+ - ".rubocop_base.yml"
166
+ - ".rubocop_cc.yml"
164
167
  - ".travis.yml"
165
168
  - CODE_OF_CONDUCT.md
166
169
  - Gemfile
@@ -175,6 +178,7 @@ files:
175
178
  - docs/apib/canister.apib
176
179
  - docs/apib/chassis.apib
177
180
  - docs/apib/cmm.apib
181
+ - docs/apib/compliance_policies.apib
178
182
  - docs/apib/config_pattern.apib
179
183
  - docs/apib/config_profile.apib
180
184
  - docs/apib/config_target.apib
@@ -192,6 +196,7 @@ files:
192
196
  - docs/apib/power_supply.apib
193
197
  - docs/apib/scalable_complex.apib
194
198
  - docs/apib/squisher.rb
199
+ - docs/apib/storages.apib
195
200
  - docs/apib/switches.apib
196
201
  - docs/apib/unmanage_request.apib
197
202
  - docs/apib/update_repo.apib
@@ -209,6 +214,7 @@ files:
209
214
  - lib/xclarity_client/endpoints/canister.rb
210
215
  - lib/xclarity_client/endpoints/chassi.rb
211
216
  - lib/xclarity_client/endpoints/cmm.rb
217
+ - lib/xclarity_client/endpoints/compliance_policy.rb
212
218
  - lib/xclarity_client/endpoints/config_pattern.rb
213
219
  - lib/xclarity_client/endpoints/config_profile.rb
214
220
  - lib/xclarity_client/endpoints/config_target.rb
@@ -229,6 +235,7 @@ files:
229
235
  - lib/xclarity_client/endpoints/remote_access.rb
230
236
  - lib/xclarity_client/endpoints/remotefileserver.rb
231
237
  - lib/xclarity_client/endpoints/scalable_complex.rb
238
+ - lib/xclarity_client/endpoints/storage.rb
232
239
  - lib/xclarity_client/endpoints/switch.rb
233
240
  - lib/xclarity_client/endpoints/unmanage_request.rb
234
241
  - lib/xclarity_client/endpoints/update_repo.rb
@@ -240,12 +247,44 @@ files:
240
247
  - lib/xclarity_client/errors/connection_refused.rb
241
248
  - lib/xclarity_client/errors/errors.rb
242
249
  - lib/xclarity_client/errors/hostname_unknown.rb
250
+ - lib/xclarity_client/mixins/aicc_mixin.rb
251
+ - lib/xclarity_client/mixins/cabinet_mixin.rb
252
+ - lib/xclarity_client/mixins/canister_mixin.rb
253
+ - lib/xclarity_client/mixins/chassi_mixin.rb
254
+ - lib/xclarity_client/mixins/cmm_mixin.rb
255
+ - lib/xclarity_client/mixins/compliance_policy_mixin.rb
256
+ - lib/xclarity_client/mixins/config_pattern_mixin.rb
257
+ - lib/xclarity_client/mixins/config_profile_mixin.rb
258
+ - lib/xclarity_client/mixins/config_target_mixin.rb
259
+ - lib/xclarity_client/mixins/discover_request_mixin.rb
260
+ - lib/xclarity_client/mixins/discovery_mixin.rb
261
+ - lib/xclarity_client/mixins/event_mixin.rb
262
+ - lib/xclarity_client/mixins/fan_mixin.rb
263
+ - lib/xclarity_client/mixins/fan_mux_mixin.rb
264
+ - lib/xclarity_client/mixins/ffdc_mixin.rb
265
+ - lib/xclarity_client/mixins/global_setting_mixin.rb
266
+ - lib/xclarity_client/mixins/host_platform_mixin.rb
267
+ - lib/xclarity_client/mixins/job_mixin.rb
268
+ - lib/xclarity_client/mixins/mixins.rb
269
+ - lib/xclarity_client/mixins/node_mixin.rb
270
+ - lib/xclarity_client/mixins/os_image_mixin.rb
271
+ - lib/xclarity_client/mixins/persisted_result_mixin.rb
272
+ - lib/xclarity_client/mixins/power_supply_mixin.rb
273
+ - lib/xclarity_client/mixins/remote_access_mixin.rb
274
+ - lib/xclarity_client/mixins/remote_file_server_mixin.rb
275
+ - lib/xclarity_client/mixins/scalable_complex_mixin.rb
276
+ - lib/xclarity_client/mixins/storage_mixin.rb
277
+ - lib/xclarity_client/mixins/switch_mixin.rb
278
+ - lib/xclarity_client/mixins/unmanage_request_mixin.rb
279
+ - lib/xclarity_client/mixins/update_repo_mixin.rb
280
+ - lib/xclarity_client/mixins/user_mixin.rb
243
281
  - lib/xclarity_client/schemas.rb
244
282
  - lib/xclarity_client/services/aicc_management.rb
245
283
  - lib/xclarity_client/services/cabinet_management.rb
246
284
  - lib/xclarity_client/services/canister_management.rb
247
285
  - lib/xclarity_client/services/chassi_management.rb
248
286
  - lib/xclarity_client/services/cmm_management.rb
287
+ - lib/xclarity_client/services/compliance_policy_management.rb
249
288
  - lib/xclarity_client/services/config_pattern_management.rb
250
289
  - lib/xclarity_client/services/config_profile_management.rb
251
290
  - lib/xclarity_client/services/config_target_management.rb
@@ -260,6 +299,7 @@ files:
260
299
  - lib/xclarity_client/services/job_management.rb
261
300
  - lib/xclarity_client/services/mixins/endpoint_manager_mixin.rb
262
301
  - lib/xclarity_client/services/mixins/list_name_interpreter_mixin.rb
302
+ - lib/xclarity_client/services/mixins/power_action_sender_mixin.rb
263
303
  - lib/xclarity_client/services/mixins/response_builder_mixin.rb
264
304
  - lib/xclarity_client/services/node_management.rb
265
305
  - lib/xclarity_client/services/osimage_management.rb
@@ -269,6 +309,7 @@ files:
269
309
  - lib/xclarity_client/services/remotefileserver_management.rb
270
310
  - lib/xclarity_client/services/scalable_complex_management.rb
271
311
  - lib/xclarity_client/services/services.rb
312
+ - lib/xclarity_client/services/storage_management.rb
272
313
  - lib/xclarity_client/services/switch_management.rb
273
314
  - lib/xclarity_client/services/unmanage_request_management.rb
274
315
  - lib/xclarity_client/services/update_repo_management.rb
@@ -279,7 +320,6 @@ files:
279
320
  - lib/xclarity_client/version.rb
280
321
  - lib/xclarity_client/xclarity_base.rb
281
322
  - lib/xclarity_client/xclarity_credentials_validator.rb
282
- - lib/xclarity_client/xclarity_power_management_mixin.rb
283
323
  - xclarity_client.gemspec
284
324
  homepage: https://github.com/lenovo/xclarity_client
285
325
  licenses: []
@@ -1,36 +0,0 @@
1
- # Top Level Xclarity module
2
- module XClarityClient
3
- # Power management mixin
4
- module PowerManagementMixin
5
- def power_on_node(uuid = '')
6
- NodeManagement.new(@connection).set_node_power_state(uuid, :powerOn)
7
- end
8
-
9
- def power_off_node(uuid = '')
10
- NodeManagement.new(@connection).set_node_power_state(uuid, :powerOffSoftGraceful)
11
- end
12
-
13
- def power_off_node_now(uuid = '')
14
- NodeManagement.new(@connection).set_node_power_state(uuid, :powerOff)
15
- end
16
-
17
- def power_restart_node(uuid = '')
18
- client = NodeManagement.new(@connection)
19
- client.set_node_power_state(uuid, :powerCycleSoftGrace)
20
- end
21
-
22
- def power_restart_node_now(uuid = '')
23
- client = NodeManagement.new(@connection)
24
- client.set_node_power_state(uuid, :powerCycleSoft)
25
- end
26
-
27
- def power_restart_node_controller(uuid = '')
28
- client = NodeManagement.new(@connection)
29
- client.set_bmc_power_state(uuid, :restart)
30
- end
31
-
32
- def power_restart_node_to_setup(uuid = '')
33
- NodeManagement.new(@connection).set_node_power_state(uuid, :bootToF1)
34
- end
35
- end
36
- end