API Client#
- class ApiClient(config: ConfigManager, concurrency: int)[source]#
Provides methods for interacting with the Jamf API, specifically fetching patch data, device information, and OS versions.
The
ApiClient
manages authentication and session handling, ensuring efficient and secure communication with the Jamf API.Initializes the ApiClient with the provided
ConfigManager
.This sets up the API client with necessary credentials and session parameters for interacting with the Jamf API.
See also
- Parameters:
config (ConfigManager) – Instance of ConfigManager for loading and storing credentials.
concurrency (int)
- Raises:
ValueError – If the JamfClient configuration is invalid.
- async get_policies() List | None [source]#
Retrieves a list of patch software title IDs from the Jamf API. This function requires a valid authentication token, which is managed automatically.
- Returns:
A list of software title IDs or None if an error occurs.
- Return type:
Optional[List]
- async get_summaries(policy_ids: List) List[PatchTitle] | None [source]#
Retrieves patch summaries for the specified policy IDs from the Jamf API. This function fetches data asynchronously and compiles the results into a list of
PatchTitle
objects.- Parameters:
policy_ids (List) – List of policy IDs to retrieve summaries for.
- Returns:
List of
PatchTitle
objects containing patch summaries or None if an error occurs.- Return type:
Optional[List[PatchTitle]]
- async get_device_ids() List[int] | None [source]#
Asynchronously fetches the list of mobile device IDs from the Jamf Pro API. This method is only called if the iOS option is passed to the CLI.
- Returns:
A list of mobile device IDs or None on error.
- Return type:
Optional[List[int]]
- async get_device_os_versions(device_ids: List[int]) List[Dict[str, str]] | None [source]#
Asynchronously fetches the OS version and serial number for each device ID provided. This method is only called if the iOS option is passed to the CLI.
- async get_sofa_feed() List[Dict[str, str]] | None [source]#
Fetches iOS Data feeds from SOFA and extracts latest OS version information. To limit the amount of possible SSL verification checks, this method utilizes a subprocess call instead. This method is only called if the iOS option is passed to the CLI.