Class: XClarityClient::ManageRequestManagement
Overview
manage request management class
Instance Method Summary
collapse
#fetch_all, #get_headers_with_opts, #get_object, #get_object_with_id, #get_object_with_opts, #initialize
#build_response_with_resource_list
#add_listname_on_body
Instance Method Details
#fetch_manage_request(job_id) ⇒ Object
#manage_discovered_devices(manage_request) ⇒ Object
8
9
10
11
|
# File 'lib/xclarity_client/services/manage_request_management.rb', line 8
def manage_discovered_devices(manage_request)
@connection.do_post(ManageRequest::BASE_URI,
JSON.generate([manage_request]))
end
|
#parse_manage_request(manage_request, val) ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/xclarity_client/services/manage_request_management.rb', line 23
def parse_manage_request(manage_request, val)
return false unless val.kind_of?(Array) && !val.empty?
manage_request[:managementPorts] = val[0]['managementPorts']
manage_request[:type] = val[0]['type']
manage_request[:uuid] = val[0]['uuid']
discovery_ip_addr = val[0]['ipAddresses'][0]
manage_request[:ipAddresses] = [discovery_ip_addr]
manage_request[:os] = val[0]['os'] if val[0]['type'] == 'Rackswitch'
populate_manage_req_with_security_descriptor(manage_request, val[0])
end
|
#populate_manage_req_with_security_descriptor(manage_request, val) ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'lib/xclarity_client/services/manage_request_management.rb', line 13
def populate_manage_req_with_security_descriptor(manage_request, val)
security_descriptor = {}
val = val['securityDescriptor']
security_descriptor[:managedAuthEnabled] = val['managedAuthSupported']
security_descriptor[:managedAuthSupported] = val['managedAuthSupported']
res = security_descriptor[:managedAuthEnabled]
security_descriptor[:storedCredentials] = val['storedCredentials'] if res
manage_request[:securityDescriptor] = security_descriptor
end
|
#populate_manage_request_with_discovery_res(discovery_result, manage_request) ⇒ Object
34
35
36
37
38
39
40
41
42
|
# File 'lib/xclarity_client/services/manage_request_management.rb', line 34
def populate_manage_request_with_discovery_res(discovery_result,
manage_request)
discovery_result.map do |req|
req.instance_variables.each do |attr|
val = req.instance_variable_get(attr)
parse_manage_request(manage_request, val)
end
end
end
|
#update_manage_request(manage_request, force, discovery_result) ⇒ Object
44
45
46
47
48
|
# File 'lib/xclarity_client/services/manage_request_management.rb', line 44
def update_manage_request(manage_request, force, discovery_result)
populate_manage_request_with_discovery_res(discovery_result,
manage_request)
manage_request[:forceManage] = true if force.casecmp('true')
end
|