Jamf Client#

pydantic model JamfClient[source]#

Represents a Jamf client configuration.

This class is responsible for holding the configuration necessary to interact with the Jamf API, including client credentials, server information, and SSL settings.

Parameters:
  • client_id (AnyStr) – The client ID used for authentication with the Jamf API.

  • client_secret (AnyStr) – The client secret used for authentication with the Jamf API.

  • server (AnyStr) – The server URL for the Jamf API.

  • token (Optional[AccessToken]) – The access token used for authenticating API requests. Defaults to None.

  • max_concurrency (int) – The maximum number of concurrent API calls allowed. Defaults to 5.

  • ssl_path (ssl.DefaultVerifyPaths) – The SSL verification paths used for SSL certificate verification.

  • custom_ca_file (Optional[Union[str, Path]]) – Path to a custom Certificate Authority (CA) file for SSL verification. If provided, this file is used in place of the default CA paths.

field client_id: AnyStr [Required]#
field client_secret: AnyStr [Required]#
field custom_ca_file: str | Path | None = None#
field max_concurrency: int = 5#
field server: AnyStr [Required]#
field ssl_path: DefaultVerifyPaths = (None, '/usr/lib/ssl/certs', 'SSL_CERT_FILE', '/usr/lib/ssl/cert.pem', 'SSL_CERT_DIR', '/usr/lib/ssl/certs')#
field token: AccessToken | None = None#
classmethod not_empty(value)[source]#

Wrap a classmethod, staticmethod, property or unbound function and act as a descriptor that allows us to detect decorated items from the class’ attributes.

This class’ __get__ returns the wrapped item’s __get__ result, which makes it transparent for classmethods and staticmethods.

Attributes:

wrapped: The decorator that has to be wrapped. decorator_info: The decorator info. shim: A wrapper function to wrap V1 style function.

set_max_concurrency(concurrency: int)[source]#

Sets the maximum concurrency level for API calls.

This method allows you to set the maximum number of concurrent API calls that can be made by the Jamf client. It is recommended to limit this value to 5 connections to avoid overloading the Jamf server.

Warning

Changing this value could lead to your Jamf server being unable to perform other basic tasks. See the Concurrency option in the usage documentation.

It is strongly recommended to limit API call concurrency to no more than 5 connections. See Jamf Developer Guide for more information.

Parameters:

concurrency (int) – The new maximum concurrency level.

Raises:

ValueError – If the concurrency level is less than 1.

static valid_url(url: AnyStr) AnyStr[source]#

Validates and formats a URL to ensure it has the correct scheme and structure.

This method checks if the provided URL has a scheme (e.g., ‘https’) and a network location (netloc). If the scheme is missing, ‘https’ is assumed. The method returns the validated and correctly formatted URL.

Parameters:

url (AnyStr) – The URL to validate and format.

Returns:

The validated and formatted URL.

Return type:

AnyStr

classmethod validate_custom_ca(v)[source]#

Wrap a classmethod, staticmethod, property or unbound function and act as a descriptor that allows us to detect decorated items from the class’ attributes.

This class’ __get__ returns the wrapped item’s __get__ result, which makes it transparent for classmethods and staticmethods.

Attributes:

wrapped: The decorator that has to be wrapped. decorator_info: The decorator info. shim: A wrapper function to wrap V1 style function.

classmethod validate_ssl_paths(v)[source]#

Wrap a classmethod, staticmethod, property or unbound function and act as a descriptor that allows us to detect decorated items from the class’ attributes.

This class’ __get__ returns the wrapped item’s __get__ result, which makes it transparent for classmethods and staticmethods.

Attributes:

wrapped: The decorator that has to be wrapped. decorator_info: The decorator info. shim: A wrapper function to wrap V1 style function.

classmethod validate_url(v)[source]#

Wrap a classmethod, staticmethod, property or unbound function and act as a descriptor that allows us to detect decorated items from the class’ attributes.

This class’ __get__ returns the wrapped item’s __get__ result, which makes it transparent for classmethods and staticmethods.

Attributes:

wrapped: The decorator that has to be wrapped. decorator_info: The decorator info. shim: A wrapper function to wrap V1 style function.

property base_url#

Gets the base URL of the Jamf server.

Returns:

The base URL of the Jamf server.

Return type:

AnyStr

property cafile: str#

Gets the path to the CA file used for SSL verification.

If a custom CA file is provided, it is returned; otherwise, the default CA file path is used.

Returns:

The path to the CA file used for SSL verification.

Return type:

str

pydantic model ApiRole[source]#

Represents an API role with specific privileges required for Patcher to operate.

The ApiRole class encapsulates the role’s name and the list of privileges associated with that role. This is necessary for managing access control and permissions within the Jamf API.

Variables:
  • display_name – The name of the API role.

  • privileges – A list of privileges assigned to the API role. These privileges determine the actions that the role can perform.

field display_name: AnyStr = 'Patcher-Role'#
field privileges: List = ['Read Patch Management Software Titles', 'Read Patch Policies', 'Read Mobile Devices', 'Read Mobile Device Inventory Collection', 'Read Mobile Device Applications', 'Read Patch Management Settings', 'Create API Integrations', 'Create API Roles', 'Read API Integrations', 'Read API Roles', 'Update API Integrations', 'Update API Roles']#
pydantic model ApiClient[source]#

Represents an API client with specific authentication scopes and settings required for Patcher.

The ApiClient class defines the configuration for an API client, including its authentication scopes, display name, whether it is enabled, and the token lifetime.

Variables:
  • auth_scopes – A list of authentication scopes assigned to the API client. These scopes define the level of access the client has.

  • display_name – The name of the API client.

  • enabled – Indicates whether the API client is currently enabled or disabled.

  • token_lifetime – The lifetime of the access token in seconds. This value determines how long the token remains valid.

field auth_scopes: List = ['Patcher-Role']#
field display_name: AnyStr = 'Patcher-Client'#
field enabled: bool = True#
field token_lifetime: int = 1800#