module Jamf::FileVault::ClassMethods
Class Methods
Public Class Methods
when this module is included, also extend our Class Methods
# File lib/jamf/api/jamf_pro/mixins/filevault.rb 50 def self.extended(extender) 51 Jamf.load_msg "--> #{extender} is extending #{self}" 52 end
Public Instance Methods
Get the filevault info for one or all computers, or Jamf::Pager
for getting all of them paged in groups.
WARNING: This data will include the plaintext FileVault
personal recovery keys. The
'View Disk Encryption Recovery Key' privilege is required.
@param computer [Symbol, String
, Integer, Array
<String, Integer>] Identifier for the desired
Computer, or :all to get data for all computers, as an Array or via a Jamf::Pager
@param paged [Boolean] when computer is :all, should we return a Jamf::Pager
to get paged results?
@param page_size [Integer] when computer is :all and paged: is true, how many results to return in each page.
@param cnx [Jamf::Connection] The API connection to use. Defaults to Jamf.cnx
@return [Jamf::OAPISchemas::ComputerInventoryFileVault, Array
<Jamf::OAPISchemas::ComputerInventoryFileVault>, Jamf::Pager
]
The filevault info for a computer, all computers, or a Jamf::Pager to get all computers in pages.
# File lib/jamf/api/jamf_pro/mixins/filevault.rb 72 def filevault_info(computer, paged: false, page_size: Jamf::Pager::DEFAULT_PAGE_SIZE, cnx: Jamf.cnx) 73 return all_computers(paged: paged, page_size: page_size, cnx: cnx) if computer == :all 74 75 id = Jamf::Computer.valid_id computer 76 raise Jamf::NoSuchItemError, "No computer matches identifier '#{computer}'" unless id 77 78 data = cnx.jp_get "#{Jamf::Computer::JPAPI_INVENTORY_RSRC}/#{id}/#{FILEVAULT_RSRC_SUFFIX}" 79 Jamf::OAPISchemas::ComputerInventoryFileVault.new data 80 81 # if we get a 404 NOT FOUND error, this given computer has no FV data, so just return nil 82 rescue Jamf::Connection::JamfProAPIError => e 83 raise unless e.http_status == 404 84 85 nil 86 end
Private Instance Methods
return info for all computers, possibly as a Pager
@see .filevault_info
# File lib/jamf/api/jamf_pro/mixins/filevault.rb 91 def all_computers(paged: false, page_size: nil, cnx: Jamf.cnx) 92 list_path = "#{Jamf::Computer::JPAPI_INVENTORY_RSRC}/#{FILEVAULT_RSRC_SUFFIX}" 93 if paged 94 Jamf::Pager.new( 95 page_size: page_size, 96 list_path: list_path, 97 instantiate: Jamf::OAPISchemas::ComputerInventoryFileVault, 98 cnx: cnx 99 ) 100 else 101 Jamf::Pager.all_pages( 102 list_path: list_path, 103 instantiate: Jamf::OAPISchemas::ComputerInventoryFileVault, 104 cnx: cnx 105 ) 106 end 107 end