Class: XClarityClient::CompliancePolicyManagement

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

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

#assign_compliance_policy(opts = {}, keep, auto_assign) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/xclarity_client/services/compliance_policy_management.rb', line 23

def assign_compliance_policy(opts = {}, keep, auto_assign)
  assign_hash = {:policyname => opts["policyname"], :type => opts["type"], :uuid => opts["uuid"]}
  
  #Append keep only if value is false since default is true.
  if keep.eql? "False" or keep.eql? "false"
    assign_hash.merge!({:keep => false})
  end
  
  #Append auto_assign only is value is true since default is false  
  if auto_assign.eql? "True" or auto_assign.eql? "true"
    assign_hash.merge!({:autoAssign => true})
  end

  assign_hash_str = assign_hash.to_json
  response = @connection.do_post(managed_resource::SUB_URIS[:compareResult], "{\"compliance\": [#{assign_hash_str}]}") 
  response.body
end

#delete_compliance_policy(policy_name, removePackage) ⇒ Object



41
42
43
44
45
46
# File 'lib/xclarity_client/services/compliance_policy_management.rb', line 41

def delete_compliance_policy(policy_name,removePackage)
  query = policy_name.nil? ? "" : "?policyName=" + policy_name
  query = removePackage.nil? ? query : query + "&removePackage=" + removePackage 
  response = @connection.do_delete(managed_resource::BASE_URI + query)
  response.body
end

#get_applicable_firmwareObject



7
8
9
# File 'lib/xclarity_client/services/compliance_policy_management.rb', line 7

def get_applicable_firmware
  get_update_policy(managed_resource::SUB_URIS[:applicableFirmware], {})
end

#get_compare_results(opts = {}) ⇒ Object



15
16
17
# File 'lib/xclarity_client/services/compliance_policy_management.rb', line 15

def get_compare_results(opts = {})
  get_update_policy(managed_resource::SUB_URIS[:compareResult], opts)
end

#get_persisted_compare_results(opts = {}) ⇒ Object



11
12
13
# File 'lib/xclarity_client/services/compliance_policy_management.rb', line 11

def get_persisted_compare_results(opts = {})
  get_update_policy(managed_resource::SUB_URIS[:persistedResult], opts)
end

#get_update_policy(uri, opts = {}) ⇒ Object



19
20
21
# File 'lib/xclarity_client/services/compliance_policy_management.rb', line 19

def get_update_policy(uri, opts = {})
  fetch_all(opts, uri)
end