Patch Models#

class PatchTitle(*, title: str, title_id: str, released: str, hosts_patched: int, missing_patch: int, latest_version: str, completion_percent: float = 0.0, total_hosts: int = 0, name_id: str | None = None, sources: dict[str, list[str]]=<factory>)[source]#

Represents patch software title information retrieved via API calls.

Variables:
  • title – The name of the patch title.

  • title_id – The softwareTitleId of the patch title from Jamf API response.

  • released – The release date of the patch title.

  • hosts_patched – The number of hosts that have applied the patch.

  • missing_patch – The number of hosts missing the patch.

  • latest_version – The latest version available for the software title.

  • completion_percent – The percentage of hosts that have applied the patch.

  • total_hosts – The total number of hosts.

  • name_id – Internal match key, stripped from rendered reports.

  • sources – Maps each matched integration source to its identifiers: catalog slugs for Installomator and Homebrew Cask, AutoPkg repo names, and the Jamf title for Jamf App Installers.

Parameters:

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

classmethod cast_as_string(value: int | str) str[source]#

Ensures the title_id property is always a string, regardless of type in API response payload.

Parameters:

value (int | str) – The value of the title_id field.

Returns:

The value cast as a string.

Return type:

str

calculate_completion_percent()[source]#

Calculates the completion percentage and total hosts of a PatchTitle object based on hosts patched and missing patch.

See get_summaries()

Patch Device#

class PatchDevice(*, computerName: str, deviceId: str, username: str, operatingSystemVersion: str, lastContactTime: datetime, buildingName: str | None = None, departmentName: str | None = None, siteName: str | None = None, version: str)[source]#

Represents device information from Jamf Pro patch management data.

Variables:
  • computer_name – The name of the computer.

  • device_id – The unique device identifier from Jamf Pro.

  • username – The username associated with the device.

  • operating_system_version – The macOS version running on the device.

  • last_contact_time – The last time the device contacted Jamf Pro.

  • building_name – The building assignment for the device, if any.

  • department_name – The department assignment for the device, if any.

  • site_name – The site assignment for the device, if any.

  • version – The patch software version installed on the device.

Parameters:
  • computerName (str)

  • deviceId (str)

  • username (str)

  • operatingSystemVersion (str)

  • lastContactTime (datetime)

  • buildingName (str | None)

  • departmentName (str | None)

  • siteName (str | None)

  • version (str)

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

classmethod cast_as_string(value: int | str) str[source]#

Ensures the device_id property is always a string, regardless of type in API response payload.

Parameters:

value (int | str) – The value of the device_id field.

Returns:

The value cast as a string.

Return type:

str

classmethod empty_str_to_none(value: str) str | None[source]#

Converts empty strings to None for optional organizational fields.

Parameters:

value (str) – The value of the organizational field.

Returns:

None if empty string, otherwise the original value.

Return type:

str | None