Class: XClarityClient::ManagementServerManagement

Inherits:
Services::XClarityService show all
Defined in:
lib/xclarity_client/services/management_server_management.rb

Overview

ManagementServerManagement class

Instance Method Summary collapse

Methods inherited from Services::XClarityService

#fetch_all, #get_headers_with_opts, #get_object, #get_object_with_id, #get_object_with_opts, #initialize

Methods included from Services::ResponseBuilderMixin

#build_response_with_resource_list

Methods included from Services::ListNameInterpreterMixin

#add_listname_on_body

Constructor Details

This class inherits a constructor from XClarityClient::Services::XClarityService

Instance Method Details

#apply_management_server_updates(fixids) ⇒ Object



66
67
68
69
70
71
# File 'lib/xclarity_client/services/management_server_management.rb', line 66

def apply_management_server_updates(fixids)
  url = "#{ManagementServer::BASE_URI}?action=apply"
  opts = { :fixids => fixids }
  request_body = JSON.generate(opts)
  @connection.do_put(url, request_body)
end

#delete_management_server_updates(fixids) ⇒ Object



73
74
75
76
77
# File 'lib/xclarity_client/services/management_server_management.rb', line 73

def delete_management_server_updates(fixids)
  fixids = fixids.join(',')
  url = "#{ManagementServer::BASE_URI}/#{fixids}"
  @connection.do_delete(url)
end

#download_management_server_updates(fixids) ⇒ Object



46
47
48
49
50
51
# File 'lib/xclarity_client/services/management_server_management.rb', line 46

def download_management_server_updates(fixids)
  url = "#{ManagementServer::BASE_URI}?action=acquire"
  opts = { :fixids => fixids }
  request_body = JSON.generate(opts)
  @connection.do_post(url, request_body)
end

#get_management_server_updates_info(key = nil) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/xclarity_client/services/management_server_management.rb', line 38

def get_management_server_updates_info(key = nil)
  base_url = ManagementServer::BASE_URI
  url = key.nil? ? base_url : "#{base_url}?key=#{key}"
  msg = "input key=#{key}"
  $lxca_log.info(self.class.to_s + ' ' + __method__.to_s, msg)
  @connection.do_get(url)
end

#import_management_server_updates(files) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/xclarity_client/services/management_server_management.rb', line 53

def import_management_server_updates(files)
  url = "#{ManagementServer::BASE_URI}?action=import"
  file_type_dict = { '.txt' => 'text/plain', '.xml' => 'text/xml',
                     '.chg' => 'application/octet-stream',
                     '.tgz' => 'application/x-compressed' }
  payload_files = populate_payload_files(files, file_type_dict)
  request_body = JSON.generate(:files => payload_files)
  response = @connection.do_post(url, request_body)
  jobid = JSON.parse(response.body)['jobid']
  $lxca_log.info(self.class.to_s + ' ' + __method__.to_s, "jobid: #{jobid}")
  start_management_server_updates_import_job(file_type_dict, files, jobid)
end

#refresh_management_server_updates_catalogObject



79
80
81
82
83
84
# File 'lib/xclarity_client/services/management_server_management.rb', line 79

def refresh_management_server_updates_catalog
  url = "#{ManagementServer::BASE_URI}?action=refresh"
  opts = { :mts => ['lxca'] }
  request_body = JSON.generate(opts)
  @connection.do_post(url, request_body)
end