Method: Jamf::Prestage::ClassMethods#serials_for_prestage

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

#serials_for_prestage(prestage_ident, refresh = false, cnx: Jamf.cnx) ⇒ Array<String>

Get the assigned serialnumbers for a given prestage, without having to instantiate it

Parameters:

  • refresh (Boolean) (defaults to: false)

    re-read the list from the API? DEPRECATED: the data is always read from the API. If making many calls at once, consisider capturing serials_by_prestage_id in your own variable and using it as this method does

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

    the API connection to use

Returns:

  • (Array<String>)

    the SN’s assigned to the prestage

Raises:



118
119
120
121
122
123
# File 'lib/jamf/api/jamf_pro/mixins/prestage.rb', line 118

def serials_for_prestage(prestage_ident, refresh = false, cnx: Jamf.cnx) # rubocop:disable Lint/UnusedMethodArgument
  id = valid_id prestage_ident, cnx: cnx
  raise Jamf::NoSuchItemError, "No #{self} matching '#{prestage_ident}'" unless id

  serials_by_prestage_id(cnx: cnx).select { |_sn, psid| id == psid }.keys
end