Class: XClarityClient::UpdateRepoManagement

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

Instance Method Summary collapse

Methods inherited from Services::XClarityService

#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

#acquire_firmware_updates(scope, fixids, mt) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/xclarity_client/services/update_repo_management.rb', line 63

def acquire_firmware_updates(scope, fixids, mt)
  if scope.casecmp('payloads') != 0
    raise 'Invalid argument combination of action and scope. Action'\
           + ' acquire can have scope as payloads'
  end
  acquire_req = JSON.generate(:mt => mt, :fixids => fixids,
                              :type => 'latest')
  response = @connection.do_put(UpdateRepo::BASE_URI\
                                + '?action=acquire&with='\
                                + scope.downcase, acquire_req)
  response.body
end

#check_file_types(file_types) ⇒ Object



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

def check_file_types(file_types)
  x = 'Invalid value for argument file_types. Allowed values are'\
           + ' - all and payloads'
  raise x unless file_types.casecmp('payloads').zero? ||
                 file_types.casecmp('all').zero?
end

#delete_firmware_updates(file_types, fixids) ⇒ Object



76
77
78
79
80
81
82
83
# File 'lib/xclarity_client/services/update_repo_management.rb', line 76

def delete_firmware_updates(file_types, fixids)
  check_file_types(file_types)
  delete_req = JSON.generate(:fixids => fixids)
  response = @connection.do_put(UpdateRepo::BASE_URI + '?action='\
                                + 'delete&filetypes=' + file_types.downcase,
                                delete_req)
  response.body
end

#export_firmware_updates(file_types, fixids) ⇒ Object



85
86
87
88
89
90
91
92
93
# File 'lib/xclarity_client/services/update_repo_management.rb', line 85

def export_firmware_updates(file_types, fixids)
  check_file_types(file_types)

  export_req = JSON.generate(:fixids => fixids)
  response = @connection.do_put(UpdateRepo::BASE_URI\
                                + '?action=export&filetypes='\
                                + file_types.downcase, export_req)
  response.body
end

#fetch_all(opts = {}) ⇒ Object



5
6
7
8
# File 'lib/xclarity_client/services/update_repo_management.rb', line 5

def fetch_all(opts = {})
  validate_opts(opts)
  super(opts)
end

#read_update_repoObject



46
47
48
49
# File 'lib/xclarity_client/services/update_repo_management.rb', line 46

def read_update_repo
  response = @connection.do_put(UpdateRepo::BASE_URI + '?action=read')
  response.body
end

#refresh_update_repo(scope, mt, os) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/xclarity_client/services/update_repo_management.rb', line 51

def refresh_update_repo(scope, mt, os)
  if scope.casecmp('all') != 0 && scope.casecmp('latest') != 0
    raise 'Invalid argument combination of action and scope. Action'\
           + ' refresh can have scope as either all or latest'
  end
  refresh_req = JSON.generate(:mt => mt, :os => os, :type => 'catalog')
  response = @connection.do_put(UpdateRepo::BASE_URI\
                                + '?action=refresh&with='\
                                + scope.downcase, refresh_req)
  response.body
end