Module: Jamf::FileVault::ClassMethods

Defined in:
lib/jamf/api/jamf_pro/mixins/filevault.rb

Overview

Class Methods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(extender) ⇒ Object

when this module is included, also extend our Class Methods



50
51
52
# File 'lib/jamf/api/jamf_pro/mixins/filevault.rb', line 50

def self.extended(extender)
  Jamf.load_msg "--> #{extender} is extending #{self}"
end

Instance Method Details

#filevault_info(computer, paged: false, page_size: Jamf::Pager::DEFAULT_PAGE_SIZE, cnx: Jamf.cnx) ⇒ Jamf::OAPISchemas::ComputerInventoryFileVault, ...

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.

Parameters:

  • 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

  • paged (Boolean) (defaults to: false)

    when computer is :all, should we return a Jamf::Pager to get paged results?

  • page_size (Integer) (defaults to: Jamf::Pager::DEFAULT_PAGE_SIZE)

    when computer is :all and paged: is true, how many results to return in each page.

  • cnx (Jamf::Connection) (defaults to: Jamf.cnx)

    The API connection to use. Defaults to Jamf.cnx

Returns:



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/jamf/api/jamf_pro/mixins/filevault.rb', line 72

def filevault_info(computer, paged: false, page_size: Jamf::Pager::DEFAULT_PAGE_SIZE, cnx: Jamf.cnx)
  return all_computers(paged: paged, page_size: page_size, cnx: cnx) if computer == :all

  id = Jamf::Computer.valid_id computer
  raise Jamf::NoSuchItemError, "No computer matches identifier '#{computer}'" unless id

  data = cnx.jp_get "#{Jamf::Computer::JPAPI_INVENTORY_RSRC}/#{id}/#{FILEVAULT_RSRC_SUFFIX}"
  Jamf::OAPISchemas::ComputerInventoryFileVault.new data

# if we get a 404 NOT FOUND error, this given computer has no FV data, so just return nil
rescue Jamf::Connection::JamfProAPIError => e
  raise unless e.http_status == 404

  nil
end