xclarity_client 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/apib/event.apib +11 -0
- data/docs/apib/update_repo.apib +56 -0
- data/lib/xclarity_client/configuration.rb +43 -19
- data/lib/xclarity_client/connection/connection.rb +45 -37
- data/lib/xclarity_client/endpoints/buildable_resource_mixin.rb +6 -1
- data/lib/xclarity_client/endpoints/globalsettings.rb +0 -5
- data/lib/xclarity_client/endpoints/hostplatform.rb +0 -4
- data/lib/xclarity_client/endpoints/osimage.rb +0 -4
- data/lib/xclarity_client/endpoints/remotefileserver.rb +0 -4
- data/lib/xclarity_client/mixins/event_mixin.rb +6 -0
- data/lib/xclarity_client/mixins/global_setting_mixin.rb +1 -1
- data/lib/xclarity_client/mixins/host_platform_mixin.rb +1 -1
- data/lib/xclarity_client/mixins/os_image_mixin.rb +1 -1
- data/lib/xclarity_client/mixins/remote_file_server_mixin.rb +1 -1
- data/lib/xclarity_client/mixins/update_repo_mixin.rb +23 -0
- data/lib/xclarity_client/schemas.rb +183 -194
- data/lib/xclarity_client/services/compliance_policy_management.rb +4 -6
- data/lib/xclarity_client/services/globalsettings_management.rb +8 -15
- data/lib/xclarity_client/services/hostplatform_management.rb +9 -18
- data/lib/xclarity_client/services/osimage_management.rb +12 -24
- data/lib/xclarity_client/services/remotefileserver_management.rb +13 -25
- data/lib/xclarity_client/services/update_repo_management.rb +58 -0
- data/lib/xclarity_client/services/xclarity_service.rb +27 -32
- data/lib/xclarity_client/version.rb +1 -1
- data/xclarity_client.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 925a13b7e8f9b9f52254d8bc8e223f66575d906f
|
4
|
+
data.tar.gz: 49143f5132f618303c665035b8e07e1f48bd627a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea345864b94e0a2abac7a61c9074c2fc8cfc7cad540b51bf711d3523813108232e7ca014c160c710067e9f8a2cd9f18f1c40b0fb06ae830b53c8b46a0ed3b454
|
7
|
+
data.tar.gz: ed2ac8bcef67945b1dcb403b8eeab2dc8712366768950c06449fe13acb5a71621ecfe26d02b7b9a402109e0e141b302fb8a55b2afed309af02a3ec49998fa0a8
|
data/docs/apib/event.apib
CHANGED
@@ -4,8 +4,19 @@ FORMAT: 1A
|
|
4
4
|
|
5
5
|
# GET /events
|
6
6
|
|
7
|
+
+ Request (application/json)
|
8
|
+
|
9
|
+
+ Response 200 (application/json)
|
10
|
+
[ { "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", "senderUUID": "", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "commonEventID": "FQXHMTS0012X", "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", "senderUUID": "", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "commonEventID": "FQXHMTS0012X", "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", "senderUUID": "", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "commonEventID": "FQXHMTS0012X", "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" } ]
|
11
|
+
|
12
|
+
+ Request (application/json)
|
13
|
+
+ Header
|
14
|
+
Range: "0-1"
|
15
|
+
|
7
16
|
+ Response 200 (application/json)
|
8
17
|
[ { "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", "senderUUID": "", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "commonEventID": "FQXHMTS0012X", "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", "senderUUID": "", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "commonEventID": "FQXHMTS0012X", "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", "senderUUID": "", "serialnum": "", "sourceLogID": "", "action": 100, "parameters": {}, "localLogSequence": "", "localLogID": "", "sourceID": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "systemTypeModelText": "Not Available", "commonEventID": "FQXHMTS0012X", "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" } ]
|
18
|
+
+ Header
|
19
|
+
Content-Range: "0-1/9999"
|
9
20
|
|
10
21
|
+ Response 400
|
11
22
|
+ Response 401
|
data/docs/apib/update_repo.apib
CHANGED
@@ -1548,3 +1548,59 @@ FORMAT: 1A
|
|
1548
1548
|
+ Response 409
|
1549
1549
|
+ Response 500
|
1550
1550
|
|
1551
|
+
# XClarity Update Repositories [/updatableComponents{?action,with,filetypes}]
|
1552
|
+
|
1553
|
+
+ Parameters
|
1554
|
+
+ action - The action to take. This can be one of the following values - read, refresh, acquire, delete, export
|
1555
|
+
+ with - The scope of the action. This can be one of the following values - all, latest, payloads
|
1556
|
+
+ filetypes - When action=delete or action=export is specified, this parameter is used. Value can be set to payloads
|
1557
|
+
|
1558
|
+
## Update Repo [PUT]
|
1559
|
+
+ Request (application/json)
|
1560
|
+
{
|
1561
|
+
"mt": [
|
1562
|
+
"7167"
|
1563
|
+
],
|
1564
|
+
"os": "",
|
1565
|
+
"type": "catalog"
|
1566
|
+
}
|
1567
|
+
+ Response 200
|
1568
|
+
|
1569
|
+
+ Response 400
|
1570
|
+
+ Response 401
|
1571
|
+
+ Response 404
|
1572
|
+
+ Response 409
|
1573
|
+
+ Response 500
|
1574
|
+
|
1575
|
+
+ Request (application/json)
|
1576
|
+
{
|
1577
|
+
"fixids": [
|
1578
|
+
"brcd_fw_bcsw_nos5.0.1_anyos_noarch",
|
1579
|
+
"brcd_fw_cna_3.2.4.0_linux_32-64",
|
1580
|
+
"brcd_fw_cna_3.2.3.0_linux_32-64",
|
1581
|
+
"lenovo_fw_dsa_dsyte2f-9.61_anyos_32-64"
|
1582
|
+
],
|
1583
|
+
"mt": "0000",
|
1584
|
+
"type": "latest"
|
1585
|
+
}
|
1586
|
+
+ Response 200
|
1587
|
+
|
1588
|
+
+ Response 400
|
1589
|
+
+ Response 401
|
1590
|
+
+ Response 404
|
1591
|
+
+ Response 409
|
1592
|
+
+ Response 500
|
1593
|
+
|
1594
|
+
+ Request (application/json)
|
1595
|
+
{
|
1596
|
+
"fixids": [
|
1597
|
+
"lnvgy_fw_cmm_1aon01k-1.0.0k_anyos_noarch"
|
1598
|
+
]
|
1599
|
+
}
|
1600
|
+
+ Response 200
|
1601
|
+
|
1602
|
+
+ Response 400
|
1603
|
+
+ Response 401
|
1604
|
+
+ Response 404
|
1605
|
+
+ Response 409
|
1606
|
+
+ Response 500
|
@@ -1,43 +1,67 @@
|
|
1
1
|
module XClarityClient
|
2
2
|
class Configuration
|
3
3
|
|
4
|
-
attr_accessor :username, :password, :host, :auth_type, :port, :verify_ssl,
|
4
|
+
attr_accessor :username, :password, :host, :auth_type, :port, :verify_ssl,
|
5
|
+
:user_agent_label, :timeout
|
5
6
|
|
6
|
-
|
7
|
+
HEADER_MESSAGE = 'XClarityClient::Configuration initialize'.freeze
|
7
8
|
|
9
|
+
def initialize(args)
|
8
10
|
args.each { |key, value| send("#{key}=", value) }
|
11
|
+
validate_required_params
|
12
|
+
validate_auth_type
|
13
|
+
validate_port
|
14
|
+
validate_timeout
|
9
15
|
|
10
|
-
|
11
|
-
|
12
|
-
raise ArgumentError, "username, password, host, port and verify_ssl must all be specified"
|
13
|
-
end
|
16
|
+
$lxca_log.info(HEADER_MESSAGE, 'Configuration built successfully')
|
17
|
+
end
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
def validate_port
|
20
|
+
msg = 'The port number and host must be valid'
|
21
|
+
raise_exception(msg) unless valid_port?(port) || !host.empty?
|
22
|
+
end
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
24
|
+
def validate_timeout
|
25
|
+
msg = 'the timeout must be in seconds and an Integer'
|
26
|
+
raise_exception(msg) unless timeout.kind_of?(Integer) || timeout.nil?
|
27
|
+
end
|
23
28
|
|
24
|
-
|
29
|
+
def validate_required_params
|
30
|
+
required_params = [username, password, host, port, verify_ssl]
|
31
|
+
msg = 'The follow params: username, password, host, port and ' \
|
32
|
+
'verify_ssl must all be specified'
|
33
|
+
raise_exception(msg) if required_params.any?(&:nil?)
|
34
|
+
end
|
25
35
|
|
36
|
+
def validate_auth_type
|
37
|
+
msg = 'The auth_type must be a String'
|
38
|
+
raise_exception(msg) unless auth_type.kind_of?(String)
|
39
|
+
self.auth_type = 'basic_auth' if auth_type.strip.empty?
|
26
40
|
end
|
27
41
|
|
28
42
|
def self.default
|
29
|
-
|
43
|
+
data = {
|
30
44
|
:username => ENV['LXCA_USERNAME'],
|
31
45
|
:password => ENV['LXCA_PASSWORD'],
|
32
46
|
:host => ENV['LXCA_HOST'],
|
33
47
|
:port => ENV['LXCA_PORT'],
|
34
|
-
:verify_ssl => ENV['LXCA_VERIFY_SSL'] !=
|
35
|
-
}
|
48
|
+
:verify_ssl => ENV['LXCA_VERIFY_SSL'] != 'NONE'
|
49
|
+
}
|
50
|
+
new(data)
|
36
51
|
end
|
37
52
|
|
38
|
-
|
53
|
+
private
|
54
|
+
|
55
|
+
def valid_port?(param)
|
39
56
|
param = param.to_s
|
40
|
-
|
57
|
+
expression = '^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}' \
|
58
|
+
'|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$'
|
59
|
+
!/#{expression}/.match(param).nil?
|
60
|
+
end
|
61
|
+
|
62
|
+
def raise_exception(message)
|
63
|
+
$lxca_log.error(HEADER_MESSAGE, message)
|
64
|
+
raise(ArgumentError, message)
|
41
65
|
end
|
42
66
|
end
|
43
67
|
end
|
@@ -2,6 +2,7 @@ require 'faraday'
|
|
2
2
|
require 'faraday-cookie_jar'
|
3
3
|
require 'uri'
|
4
4
|
require 'uri/https'
|
5
|
+
require 'timeout'
|
5
6
|
|
6
7
|
module XClarityClient
|
7
8
|
#
|
@@ -9,6 +10,7 @@ module XClarityClient
|
|
9
10
|
# with the API.
|
10
11
|
#
|
11
12
|
class Connection
|
13
|
+
HEADER_MESSAGE = 'XClarityClient::Connection'.freeze
|
12
14
|
#
|
13
15
|
# @param [Hash] configuration - the data to create a connection with the LXCA
|
14
16
|
# @option configuration [String] :host the LXCA host
|
@@ -18,9 +20,11 @@ module XClarityClient
|
|
18
20
|
# @option configuration [String] :auth_type the type of the authentication ('token', 'basic_auth')
|
19
21
|
# @option configuration [String] :verify_ssl ('PEER', 'NONE')
|
20
22
|
# @option configuration [String] :user_agent_label Api gem client identification
|
23
|
+
# @option configuration [String] :timeout the limit time in seconds
|
21
24
|
#
|
22
25
|
def initialize(configuration)
|
23
26
|
@connection = build(configuration)
|
27
|
+
@timeout = configuration.timeout
|
24
28
|
end
|
25
29
|
|
26
30
|
#
|
@@ -28,12 +32,20 @@ module XClarityClient
|
|
28
32
|
#
|
29
33
|
# @param [String] uri - endpoint to do the request
|
30
34
|
# @param [Hash] query - params to query the endpoint resources
|
35
|
+
# @param [Hash] headers - add headers to the request
|
31
36
|
#
|
32
|
-
def do_get(uri = "", query
|
37
|
+
def do_get(uri = "", query: {}, headers: {})
|
33
38
|
url_query = query.size > 0 ? "?" + query.map {|k, v| "#{k}=#{v}"}.join("&") : ""
|
34
|
-
|
35
|
-
|
36
|
-
|
39
|
+
Timeout.timeout(@timeout) do
|
40
|
+
@connection.get do |req|
|
41
|
+
req.url(uri + url_query)
|
42
|
+
headers.map { |key, value| req.headers[key] = value }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
rescue Faraday::Error::ConnectionFailed, Timeout::Error => e
|
46
|
+
msg = "Error trying to send a GET to #{uri + url_query} "\
|
47
|
+
"the reason: #{e.message}"
|
48
|
+
$lxca_log.error(HEADER_MESSAGE + ' do_get', msg)
|
37
49
|
Faraday::Response.new
|
38
50
|
end
|
39
51
|
|
@@ -43,16 +55,8 @@ module XClarityClient
|
|
43
55
|
# @param [String] uri - endpoint to do the request
|
44
56
|
# @param [JSON] body - json to be sent in request body
|
45
57
|
#
|
46
|
-
def do_post(uri =
|
47
|
-
|
48
|
-
req.url uri
|
49
|
-
req.headers['Content-Type'] = 'application/json'
|
50
|
-
req.body = body
|
51
|
-
end
|
52
|
-
rescue Faraday::Error::ConnectionFailed => e
|
53
|
-
$lxca_log.error "XClarityClient::XclarityBase do_post", "Error trying to send a POST to #{uri}"
|
54
|
-
$lxca_log.error "XClarityClient::XclarityBase do_post", "Request sent: #{body}"
|
55
|
-
Faraday::Response.new
|
58
|
+
def do_post(uri = '', body = '')
|
59
|
+
build_request(:post, uri, body)
|
56
60
|
end
|
57
61
|
|
58
62
|
#
|
@@ -61,16 +65,8 @@ module XClarityClient
|
|
61
65
|
# @param [String] uri - endpoint to do the request
|
62
66
|
# @param [JSON] body - json to be sent in request body
|
63
67
|
#
|
64
|
-
def do_put(uri =
|
65
|
-
|
66
|
-
req.url uri
|
67
|
-
req.headers['Content-Type'] = 'application/json'
|
68
|
-
req.body = body
|
69
|
-
end
|
70
|
-
rescue Faraday::Error::ConnectionFailed => e
|
71
|
-
$lxca_log.error "XClarityClient::XclarityBase do_put", "Error trying to send a PUT to #{uri}"
|
72
|
-
$lxca_log.error "XClarityClient::XclarityBase do_put", "Request sent: #{body}"
|
73
|
-
Faraday::Response.new
|
68
|
+
def do_put(uri = '', body = '')
|
69
|
+
build_request(:put, uri, body)
|
74
70
|
end
|
75
71
|
|
76
72
|
#
|
@@ -78,17 +74,30 @@ module XClarityClient
|
|
78
74
|
#
|
79
75
|
# @param [String] uri - endpoint to do the request
|
80
76
|
#
|
81
|
-
def do_delete(uri =
|
82
|
-
|
83
|
-
req.url uri
|
84
|
-
req.headers['Content-Type'] = 'application/json'
|
85
|
-
end
|
77
|
+
def do_delete(uri = '')
|
78
|
+
build_request(:delete, uri)
|
86
79
|
end
|
87
80
|
|
88
81
|
private
|
89
82
|
|
83
|
+
def build_request(method, url, body = '')
|
84
|
+
@connection.send(method) do |request|
|
85
|
+
request.url(url)
|
86
|
+
request.headers['Content-Type'] = 'application/json'
|
87
|
+
request.body = body
|
88
|
+
end
|
89
|
+
rescue Faraday::Error::ConnectionFailed => e
|
90
|
+
header = HEADER_MESSAGE + " do_#{method}"
|
91
|
+
msg = "Error trying to send a #{method} to #{url} " \
|
92
|
+
"the reason: #{e.message}"
|
93
|
+
$lxca_log.error(header, msg)
|
94
|
+
$lxca_log.error(header, "Request sent: #{body}")
|
95
|
+
Faraday::Response.new
|
96
|
+
end
|
97
|
+
|
90
98
|
def build(configuration)
|
91
|
-
|
99
|
+
header = HEADER_MESSAGE + ' build'
|
100
|
+
$lxca_log.info(header, 'Building the connection')
|
92
101
|
|
93
102
|
hostname = URI.parse(configuration.host)
|
94
103
|
|
@@ -96,21 +105,20 @@ module XClarityClient
|
|
96
105
|
:port => configuration.port.to_i,
|
97
106
|
:query => hostname.query,
|
98
107
|
:fragment => hostname.fragment }).to_s
|
99
|
-
|
100
|
-
$lxca_log.info "XClarityClient::XClarityBase connection_builder", "Creating connection to #{url}"
|
108
|
+
$lxca_log.info(header, "Creating connection to #{url}")
|
101
109
|
|
102
110
|
connection = Faraday.new(url: url) do |faraday|
|
103
|
-
faraday.request
|
104
|
-
faraday.response
|
105
|
-
faraday.use
|
106
|
-
faraday.adapter
|
111
|
+
faraday.request(:url_encoded) # form-encode POST params
|
112
|
+
faraday.response(:logger, $lxca_log.log) # log requests to log file
|
113
|
+
faraday.use(:cookie_jar) if configuration.auth_type == 'token'
|
114
|
+
faraday.adapter(:httpclient) # make requests with HTTPClient
|
107
115
|
faraday.ssl[:verify] = configuration.verify_ssl == 'PEER'
|
108
116
|
end
|
109
117
|
|
110
118
|
connection.headers[:user_agent] = "LXCA via Ruby Client/#{XClarityClient::VERSION}" + (configuration.user_agent_label.nil? ? "" : " (#{configuration.user_agent_label})")
|
111
119
|
|
112
120
|
connection.basic_auth(configuration.username, configuration.password) if configuration.auth_type == 'basic_auth'
|
113
|
-
$lxca_log.info
|
121
|
+
$lxca_log.info(header, 'Connection created Successfuly')
|
114
122
|
|
115
123
|
connection
|
116
124
|
end
|
@@ -40,7 +40,12 @@ module XClarityClient
|
|
40
40
|
key = format_key(key)
|
41
41
|
send("#{key}=", value)
|
42
42
|
rescue
|
43
|
-
|
43
|
+
unless defined?(Rails).nil?
|
44
|
+
$lxca_log.info(
|
45
|
+
'XClarityClient::Endpoints::BuildableResourceMixin',
|
46
|
+
"UNEXISTING ATTRIBUTES FOR #{self.class}: #{key}"
|
47
|
+
)
|
48
|
+
end
|
44
49
|
end
|
45
50
|
|
46
51
|
#
|
@@ -1,12 +1,7 @@
|
|
1
1
|
module XClarityClient
|
2
2
|
class GlobalSetting < Endpoints::XclarityEndpoint
|
3
3
|
BASE_URI = '/osdeployment/globalSettings'.freeze
|
4
|
-
|
5
4
|
attr_accessor :activeDirectory, :credentials, :ipAssignment,
|
6
5
|
:isVLANMode, :licenseKeys
|
7
|
-
|
8
|
-
def initialize(attributes)
|
9
|
-
build_resource(attributes)
|
10
|
-
end
|
11
6
|
end
|
12
7
|
end
|
@@ -10,5 +10,11 @@ module XClarityClient
|
|
10
10
|
def fetch_events(opts = {})
|
11
11
|
EventManagement.new(@config).get_object_with_opts(opts, Event)
|
12
12
|
end
|
13
|
+
|
14
|
+
def get_last_cn(opts = {})
|
15
|
+
headers = EventManagement.new(@config).get_headers_with_opts(opts, Event)
|
16
|
+
range = headers['content-range']
|
17
|
+
range.slice(range.index('/') + 1, range.length).to_i
|
18
|
+
end
|
13
19
|
end
|
14
20
|
end
|
@@ -6,5 +6,28 @@ module XClarityClient
|
|
6
6
|
def discover_update_repo(opts = {})
|
7
7
|
UpdateRepoManagement.new(@config).fetch_all(opts)
|
8
8
|
end
|
9
|
+
|
10
|
+
def read_update_repo
|
11
|
+
UpdateRepoManagement.new(@config).read_update_repo
|
12
|
+
end
|
13
|
+
|
14
|
+
def refresh_update_repo(scope, mt, os)
|
15
|
+
UpdateRepoManagement.new(@config).refresh_update_repo(scope, mt, os)
|
16
|
+
end
|
17
|
+
|
18
|
+
def acquire_firmware_updates(scope, fixids, mt)
|
19
|
+
UpdateRepoManagement.new(@config).acquire_firmware_updates(scope,
|
20
|
+
fixids, mt)
|
21
|
+
end
|
22
|
+
|
23
|
+
def delete_firmware_updates(file_types, fixids)
|
24
|
+
UpdateRepoManagement.new(@config).delete_firmware_updates(file_types,
|
25
|
+
fixids)
|
26
|
+
end
|
27
|
+
|
28
|
+
def export_firmware_updates(file_types, fixids)
|
29
|
+
UpdateRepoManagement.new(@config).export_firmware_updates(file_types,
|
30
|
+
fixids)
|
31
|
+
end
|
9
32
|
end
|
10
33
|
end
|