xclarity_client 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ conf = XClarityClient::Configuration.new(
4
4
  :username => '',
5
5
  :password => '',
6
6
  :host => '',
7
+ :port => '',
7
8
  :auth_type => '',
8
9
  :verify_ssl => ''
9
10
  )
@@ -43,9 +43,15 @@ require 'xclarity_client/user'
43
43
  require 'xclarity_client/user_management'
44
44
  require 'xclarity_client/discover'
45
45
  require 'xclarity_client/client'
46
-
46
+ require 'xclarity_client/config_target'
47
+ require 'xclarity_client/config_target_management'
48
+ require 'xclarity_client/config_profile'
49
+ require 'xclarity_client/config_profile_management'
50
+ require 'xclarity_client/config_pattern'
51
+ require 'xclarity_client/config_pattern_management'
47
52
  require 'xclarity_client/error/authentication_error'
48
53
  require 'xclarity_client/error/connection_failed'
49
54
  require 'xclarity_client/error/connection_failed_unknown'
50
55
  require 'xclarity_client/error/connection_refused'
51
56
  require 'xclarity_client/error/hostname_unknown'
57
+
@@ -203,6 +203,78 @@ module XClarityClient
203
203
  User)
204
204
  end
205
205
 
206
+ def fetch_config_target(ids=nil,
207
+ includeAttributes = nil,
208
+ excludeAttributes = nil)
209
+ ConfigTargetManagement.new(@connection).get_object_with_id(ids,
210
+ includeAttributes,
211
+ excludeAttributes,
212
+ ConfigTarget)
213
+ end
214
+
215
+ def fetch_config_profile(ids=nil,
216
+ includeAttributes = nil,
217
+ excludeAttributes = nil)
218
+ ConfigProfileManagement.new(@connection).get_object_with_id(ids,
219
+ includeAttributes,
220
+ excludeAttributes,
221
+ ConfigProfile)
222
+ end
223
+
224
+ def discover_config_profile
225
+ ConfigProfileManagement.new(@connection).population
226
+ end
227
+
228
+ def rename_config_profile(id='', name='')
229
+ ConfigProfileManagement.new(@connection).rename_config_profile(id,
230
+ name)
231
+ end
232
+
233
+ def activate_config_profile(id='', endpoint_uuid='', restart='')
234
+ ConfigProfileManagement.new(@connection).activate_config_profile(id,
235
+ endpoint_uuid,
236
+ restart)
237
+ end
238
+
239
+ def unassign_config_profile(id='', powerDown='',resetImm='',force='')
240
+ ConfigProfileManagement.new(@connection).unassign_config_profile(id,
241
+ powerDown,
242
+ resetImm,
243
+ force)
244
+ end
245
+
246
+ def delete_config_profile(id='')
247
+ ConfigProfileManagement.new(@connection).delete_config_profile(id)
248
+ end
249
+
250
+ def fetch_config_pattern(ids=nil,
251
+ includeAttributes = nil,
252
+ excludeAttributes = nil)
253
+ ConfigPatternManagement.new(@connection).get_object_with_id(ids,
254
+ includeAttributes,
255
+ excludeAttributes,
256
+ ConfigPattern)
257
+ end
258
+
259
+ def discover_config_pattern
260
+ ConfigPatternManagement.new(@connection).population
261
+ end
262
+
263
+ def export_config_pattern(id='')
264
+ ConfigPatternManagement.new(@connection).export(id)
265
+ end
266
+
267
+ def deploy_config_pattern(id='',endpoints=nil,restart='',etype='')
268
+ ConfigPatternManagement.new(@connection).deploy_config_pattern(id,
269
+ endpoints,
270
+ restart,
271
+ etype)
272
+ end
273
+
274
+ def import_config_pattern(config_pattern = {})
275
+ ConfigPatternManagement.new(@connection).import_config_pattern(config_pattern)
276
+ end
277
+
206
278
  def validate_configuration
207
279
  XClarityBase.new(@connection, '/')
208
280
  end
@@ -0,0 +1,18 @@
1
+ module XClarityClient
2
+ class ConfigPattern
3
+ include XClarityClient::Resource
4
+
5
+ BASE_URI = '/patterns'.freeze
6
+ LIST_NAME = 'items'.freeze
7
+
8
+ attr_accessor :identifier, :items, :label, :id, :referencedBy, :userDefined, :formFactor, :inUse, :description, :name, :nodeType, :type,
9
+ :uri, :serverType, :template_type, :server_template, :storageSettings, :bootSettings, :adapterSettings,
10
+ :templates, :sub_templates, :useCount
11
+
12
+ def initialize(attributes)
13
+ build_resource(attributes)
14
+ end
15
+
16
+ end
17
+ end
18
+
@@ -0,0 +1,48 @@
1
+ require 'json'
2
+
3
+ module XClarityClient
4
+ class ConfigPatternManagement < XClarityBase
5
+
6
+ include XClarityClient::ManagementMixin
7
+
8
+ def initialize(conf)
9
+ super(conf, ConfigPattern::BASE_URI)
10
+ end
11
+
12
+ def population()
13
+ get_all_resources(ConfigPattern)
14
+ end
15
+
16
+ def export(id)
17
+ response = connection(ConfigPattern::BASE_URI + "/" + id + "/includeSettings" )
18
+ return [] unless response.success?
19
+
20
+ body = JSON.parse(response.body)
21
+
22
+ body = {ConfigPattern::LIST_NAME => body} if body.is_a? Array
23
+ body = {ConfigPattern::LIST_NAME => [body]} unless body.has_key? ConfigPattern::LIST_NAME
24
+ body[ConfigPattern::LIST_NAME].map do |resource_params|
25
+ ConfigPattern.new resource_params
26
+ end
27
+ end
28
+
29
+ def deploy_config_pattern(id,endpoints,restart,etype)
30
+ if etype.eql? 'node'
31
+ deployHash = {:uuid => endpoints}
32
+ elsif etype.eql? 'rack' or etype.eql? 'tower'
33
+ deployHash = {:endpointIds => endpoints}
34
+ end
35
+ deployHash.merge!({:restart => restart})
36
+ response = do_post(ConfigPattern::BASE_URI + '/' +id, JSON.generate(deployHash))
37
+ response
38
+
39
+ end
40
+
41
+ def import_config_pattern(config_pattern)
42
+ response = do_post(ConfigPattern::BASE_URI, config_pattern)
43
+ response
44
+ end
45
+
46
+ end
47
+ end
48
+
@@ -0,0 +1,19 @@
1
+ module XClarityClient
2
+ class ConfigProfile
3
+ include XClarityClient::Resource
4
+
5
+ BASE_URI = '/profiles'.freeze
6
+ LIST_NAME = 'items'.freeze
7
+
8
+ attr_accessor :identifier, :items, :label, :profileName, :serverName, :uuid, :chassisName, :bayId,
9
+ :subBayId, :profileStatus, :templateName, :templateId, :type, :id, :externalId, :managementPatternPresent,
10
+ :addressPresent, :rackId, :unit, :ID, :name, :displayName, :displayId, :endPointType, :endPointId,
11
+ :profilePath, :forScalableSecondaryNode, :secondaryProfileIDs, :serverTemplateId, :commands, :dynamicProperties, :primaryProfileID, :forScalableNode, :forScalablePrimaryNode, :deviceId, :deviceType, :managementPatternPresent, :rackID, :templateID
12
+
13
+ def initialize(attributes)
14
+ build_resource(attributes)
15
+ end
16
+
17
+ end
18
+ end
19
+
@@ -0,0 +1,41 @@
1
+ require 'json'
2
+
3
+ module XClarityClient
4
+ class ConfigProfileManagement < XClarityBase
5
+
6
+ include XClarityClient::ManagementMixin
7
+
8
+ def initialize(conf)
9
+ super(conf, ConfigProfile::BASE_URI)
10
+ end
11
+
12
+ def population()
13
+ get_all_resources(ConfigProfile)
14
+ end
15
+
16
+ def rename_config_profile(id='', name='')
17
+ renameReq = JSON.generate(profileName: name)
18
+ response = do_put(ConfigProfile::BASE_URI + '/' +id, renameReq)
19
+ response
20
+ end
21
+
22
+ def activate_config_profile(id='', endpoint_uuid='', restart='')
23
+ postReq = JSON.generate(restart: restart, uuid: endpoint_uuid)
24
+ response = do_post(ConfigProfile::BASE_URI + '/' +id, postReq)
25
+ response
26
+ end
27
+
28
+ def unassign_config_profile(id='', force='',powerDown='',resetImm='')
29
+ unassignReq = JSON.generate(force: force, powerDownITE: powerDown, resetIMM: resetImm)
30
+ response = do_post(ConfigProfile::BASE_URI + '/unassign/' +id, unassignReq)
31
+ response
32
+ end
33
+
34
+ def delete_config_profile(id='')
35
+ response = do_delete(ConfigProfile::BASE_URI + '/' + id)
36
+ response
37
+ end
38
+
39
+ end
40
+ end
41
+
@@ -0,0 +1,16 @@
1
+ module XClarityClient
2
+ class ConfigTarget
3
+ include XClarityClient::Resource
4
+
5
+ BASE_URI = '/config/target'.freeze
6
+ LIST_NAME = 'items'.freeze
7
+
8
+ attr_accessor :access, :children, :description, :firmwareLevel, :id, :ipaddresses, :name, :type, :uuid, :identifier, :label, :items
9
+
10
+ def initialize(attributes)
11
+ build_resource(attributes)
12
+ end
13
+
14
+ end
15
+ end
16
+
@@ -0,0 +1,14 @@
1
+ require 'json'
2
+ require 'uuid'
3
+
4
+ module XClarityClient
5
+ class ConfigTargetManagement < XClarityBase
6
+ include XClarityClient::ManagementMixin
7
+
8
+ def initialize(conf)
9
+ super(conf, ConfigTarget::BASE_URI)
10
+ end
11
+
12
+ end
13
+ end
14
+
@@ -16,12 +16,12 @@ module XClarityClient
16
16
  def cancel_job(uuid='')
17
17
  cancelReq = JSON.generate(cancelRequest: 'true')
18
18
  response = do_put(Job::BASE_URI + '/' + uuid, cancelReq)
19
- puts response.body
19
+ response
20
20
  end
21
21
 
22
22
  def delete_job(uuid='')
23
23
  response = do_delete(Job::BASE_URI + '/' + uuid)
24
- puts response.body
24
+ response
25
25
  end
26
26
 
27
27
  end
@@ -1,3 +1,3 @@
1
1
  module XClarityClient
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6"
3
3
  end
@@ -52,6 +52,20 @@ module XClarityClient
52
52
  end
53
53
  end
54
54
 
55
+ def do_post(uri="", request = {})
56
+ begin
57
+ @conn.post do |req|
58
+ req.url uri
59
+ req.headers['Content-Type'] = 'application/json'
60
+ req.body = request
61
+ end
62
+ rescue Faraday::Error::ConnectionFailed => e
63
+ $lxca_log.error "XClarityClient::XclarityBase do_post", "Error trying to send a POST to #{uri}"
64
+ $lxca_log.error "XClarityClient::XclarityBase do_post", "Request sent: #{request}"
65
+ Faraday::Response.new
66
+ end
67
+ end
68
+
55
69
  def do_put (uri="", request = {})
56
70
  begin
57
71
  @conn.put do |req|
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.5.5
4
+ version: 0.5.6
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: 2017-09-14 00:00:00.000000000 Z
12
+ date: 2017-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -161,6 +161,9 @@ files:
161
161
  - docs/apib/canister.apib
162
162
  - docs/apib/chassis.apib
163
163
  - docs/apib/cmm.apib
164
+ - docs/apib/config_pattern.apib
165
+ - docs/apib/config_profile.apib
166
+ - docs/apib/config_target.apib
164
167
  - docs/apib/event.apib
165
168
  - docs/apib/fan.apib
166
169
  - docs/apib/fan_mux.apib
@@ -187,6 +190,12 @@ files:
187
190
  - lib/xclarity_client/client.rb
188
191
  - lib/xclarity_client/cmm.rb
189
192
  - lib/xclarity_client/cmm_management.rb
193
+ - lib/xclarity_client/config_pattern.rb
194
+ - lib/xclarity_client/config_pattern_management.rb
195
+ - lib/xclarity_client/config_profile.rb
196
+ - lib/xclarity_client/config_profile_management.rb
197
+ - lib/xclarity_client/config_target.rb
198
+ - lib/xclarity_client/config_target_management.rb
190
199
  - lib/xclarity_client/configuration.rb
191
200
  - lib/xclarity_client/discover.rb
192
201
  - lib/xclarity_client/error/authentication_error.rb